Consolidate functions duplicated in ophys-slap2-analysis into GIAnT-MATLAB

未关闭
#36 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
matlab
领域
backend

调研方向

Start by reviewing the inventory and proposed consolidation in this issue, then compare the named GIAnT-MATLAB and ophys-slap2-analysis entry points, especially setParams, optionsGUI, and the older summarize_LoCo pipeline. The issue leaves key decisions open about retiring or freezing that pipeline and choosing an annotation format. Done means the repositories no longer have unintended function-name collisions, their dependency and path setup is documented, and the proposed path-resolution test is in place.

由索引模型根据 Issue 内容生成。

描述

GIAnT-MATLAB started on 2026-03-23 by moving processing code out of ophys-slap2-analysis, but the originals stayed there. I compared the two main branches (GIAnT-MATLAB at c69d1db, ophys-slap2-analysis at AllenNeuralDynamics/ophys-slap2-analysis@8b89d18) by file name and by content. 31 GIAnT functions have a copy or an earlier version in ophys-slap2-analysis, and two more names differ from GIAnT's only by letter case.

This causes three problems:

  1. With both repos on the MATLAB path, one copy silently shadows the other. The worst case is setParams: the two copies have the same signature but disjoint case lists. Whichever is first on the path makes the other repo's stages fail with "Unknown function name passed to setParams.m".

  2. Fixes land in only one copy. GIAnT has:

    • the nansvd padding fix
    • the drawROIs circle-radius fix
    • an error instead of keyboard in the xcorr2_nans* functions

    ophys-slap2-analysis has the optionsGUI dialog-centering fix (AllenNeuralDynamics/ophys-slap2-analysis@2282dd1), and GIAnT does not.

  3. New copies are still being made. extractDendrites now carries readTrialTableH5, an inline copy of GIAnT's loadStructFromH5, so that it doesn't need GIAnT-MATLAB on the path.

Since the split, only four of these ophys-slap2-analysis files have changed: setParams, optionsGUI, postAcquisitionAnnotation and summarize_LoCo. Every other copy there is an older version of the GIAnT code.

Inventory

A. Identical. These can be deleted from ophys-slap2-analysis once GIAnT is on its path.

GIAnT-MATLAB ophys-slap2-analysis Files calling it in ophys-slap2-analysis
dependencies/alignment/dftregistration_clipped.m matlab/dependencies/dftregistration_clipped.m 8
dependencies/alignment/interpFrame.m matlab/dependencies/interpFrame.m 2
dependencies/alignment/interpFrames.m matlab/preprocessing/interpFrames.m 1
dependencies/alignment/slap2/bandscan/makeLookupTable.m matlab/slap2/Registration/Michael/makeLookupTable.m 2
dependencies/alignment/slap2/bandscan/poissonLogLikelihoodTable.m matlab/slap2/Registration/Michael/poissonLogLikelihoodTable.m 2
dependencies/alignment/slap2/getOnlineMotion.m matlab/slap2/Registration/getOnlineMotion.m 3
dependencies/io/loadMetadata.m matlab/slap2/loadMetadata.m 9

B. Same signature, and the GIAnT copy has fixes. The GIAnT copies are drop-in replacements.

GIAnT-MATLAB ophys-slap2-analysis What GIAnT changed Callers
dependencies/alignment/xcorr2_nans.m matlab/dependencies/xcorr2_nans.m error instead of keyboard when the motion is NaN 13
dependencies/alignment/xcorr2_nans3d.m matlab/dependencies/xcorr2_nans3d.m Same 1
dependencies/alignment/xcorr2_nans_weighted.m matlab/dependencies/xcorr2_nans_weighted.m Same, plus a faster version of the same arithmetic 1
dependencies/nansvd.m matlab/dependencies/nansvd.m Pads the outputs when svds returns fewer components than requested 3
dependencies/gui/drawROIs.m matlab/dependencies/drawROIs.m Circle ROIs keep their radius, closing the window keeps the ROIs, and the display image comes from annotationDisplayImage 6
dependencies/nanmedfilt2.m matlab/dependencies/nanmedfilt2.m Licence header and an error-message typo only 3
dependencies/alignment/makeConsensusTemplate.m matlab/slap2/Registration/makeTemplateMultiRoi.m Renamed only 6

C. Same name, diverged. These are stages of the older ophys-slap2-analysis pipeline, which uses trialTable.mat and .mat alignment files.

Function GIAnT-MATLAB ophys-slap2-analysis How they differ
buildTrialTableSLAP2 buildTrialTableSLAP2.m matlab/preprocessing/buildTrialTableSLAP2.m GIAnT takes (dr, savedr, useAllFiles) and writes trial_table.h5; ophys-slap2-analysis takes (dr) and writes trialTable.mat
verifyFiles dependencies/verifyFiles.m matlab/preprocessing/verifyFiles.m ophys-slap2-analysis takes an extra params argument
loadAndProcessTrialAsync dependencies/extraction/activityImage/ matlab/preprocessing/ GIAnT takes the motion_correction folder and reads the H5 alignment layout
localizeSources_vIM dependencies/extraction/activityImage/ matlab/preprocessing/ Different first output (skIm vs summaryEroded)
processAllTrials_Async dependencies/extraction/ matlab/preprocessing/ Same signature; GIAnT expects the H5 alignment layout (alignData.slap2) and reads frames only at the sampled pixels
extractTrial dependencies/extraction/ matlab/preprocessing/ GIAnT takes an extra alignData argument
setParamsExtractTrial dependencies/extraction/ matlab/preprocessing/ The parameter sets have diverged

D. Same name, different function (collisions)

Name GIAnT-MATLAB ophys-slap2-analysis Notes
setParams dependencies/gui/setParams.m, with cases SILo, MultiRoiRegistration, BandRegistration, StripRegistration matlab/dependencies/setParams.m, with cases summarize_NoLoCo, summarize_LoCo, multiRoiRegSLAP2, integrationRegistration, stripRegBergamo, extractDendrites, summarize_Voltage Whichever comes first on the path breaks the other repo. 14 files in ophys-slap2-analysis call it.
optionsGUI dependencies/gui/optionsGUI.m matlab/dependencies/optionsGUI.m The copies have diverged substantially; only ophys-slap2-analysis has the centering fix.
postAcquisitionAnnotation utils/postAcquisitionAnnotation.m: (dr, fns), writes postacq_annotations.h5 for importPostAcqAnnotations matlab/slap2/postAcquisition/postAcquisitionAnnotation.m: (dr), its output is read by summarize_LoCo Two implementations of the same step at the rig, writing different formats
ScanImageTiffReader dependencies/io/ScanImageTiffReader.m (a MATLAB class) matlab/dependencies/+ScanImageTiffReader/ (MEX package) Two different readers under one name
MultiRoiRegistration / multiRoiRegistration motion_correction/MultiRoiRegistration.m matlab/slap2/Registration/multiRoiRegistration.m (old, no callers) The names differ only in case, which is fragile on Windows and macOS
StripRegistration / stripRegistration motion_correction/StripRegistration.m matlab/bergamo/stripRegistration.m (old, no callers) Same

E. Renamed copies. These are the ophys-slap2-analysis originals of GIAnT functions.

GIAnT-MATLAB ophys-slap2-analysis Content similarity
motion_correction/MultiRoiRegistration.m matlab/preprocessing/multiRoiRegSLAP2.m 0.75
motion_correction/StripRegistration.m matlab/preprocessing/stripRegBergamo.m 0.74
motion_correction/BandRegistration.m matlab/slap2/Registration/Michael/integrationRegistration.m 0.76
buildTrialTable.m matlab/preprocessing/buildTrialTableBergamo.m 0.54
dependencies/alignment/shiftRoiData.m Local function in matlab/preprocessing/summarize_LoCo.m
dependencies/io/loadStructFromH5.m Local readTrialTableH5 in matlab/slap2/Voltage/extractDendrites.m

Proposed consolidation

  1. Bring into GIAnT the one fix that exists only in ophys-slap2-analysis: the optionsGUI centering fix (AllenNeuralDynamics/ophys-slap2-analysis@2282dd1).

  2. Make GIAnT-MATLAB a declared dependency of ophys-slap2-analysis, in its README and with a helper that sets up the path. Then:

    • Delete groups A and B from ophys-slap2-analysis.
    • Point the 6 callers of makeTemplateMultiRoi at makeConsensusTemplate.

    One behaviour changes for ophys-slap2-analysis callers: the xcorr2_nans* functions throw an error on NaN motion instead of stopping in keyboard.

  3. Remove the collisions in group D:

    • setParams: rename the ophys-slap2-analysis copy, which only configures ophys-slap2-analysis functions, or merge both sets of cases into the GIAnT copy.
    • optionsGUI: delete the ophys-slap2-analysis copy after step 1.
    • postAcquisitionAnnotation: settle on one output format. If summarize_LoCo can read postacq_annotations.h5, delete the ophys-slap2-analysis copy.
    • multiRoiRegistration.m and bergamo/stripRegistration.m: delete them, since nothing calls them.
    • ScanImageTiffReader: check that ophys-slap2-analysis calls to ScanImageTiffReader.ScanImageTiffReader still reach the MEX package when GIAnT is on the path.
  4. Decide what happens to the older pipeline in groups C and E (multiRoiRegSLAP2 / stripRegBergamo → summarize_LoCo). It still uses its own copies and the .mat layouts, and summarize_LoCo changed as recently as 2026-08-25, so it is still in use. There are two options:

    • Retire it in favour of MultiRoiRegistration / StripRegistration → SILo, and keep in ophys-slap2-analysis only the analyses that GIAnT doesn't have, such as extractDendrites and the voltage analysis.
    • Freeze it, and rename its internals so they no longer shadow GIAnT's.
  5. Replace the inline readTrialTableH5 in extractDendrites with loadStructFromH5.

To keep the repos from drifting apart again, add a test that runs with both repos on the path and fails when any function name resolves to more than one file (which -all).

How the inventory was made. Each non-test .m file in GIAnT-MATLAB was matched against every .m file in ophys-slap2-analysis, by file name (ignoring case) and by content similarity (difflib ratio on non-comment lines). Local functions defined in both repos were listed as well. Third-party code bundled in ophys-slap2-analysis (NoRMCorre, OASIS, Fast_Tiff_Write) is out of scope.

主要语言
MATLAB
星标
3
派生
3
平均合并
1 天 22 小时
30 天内合并 PR
31

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AllenNeuralDynamics/GIAnT-MATLAB 的其他 Issue

查看 AllenNeuralDynamics/GIAnT-MATLAB 的全部 Issue

相似的 Issue

更多 MATLAB Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。