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

Abierto
#36 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
matlab
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
MATLAB
Estrellas
3
Forks
3
Merge medio
1 d 22 h
PR fusionados (30 d)
31

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de AllenNeuralDynamics/GIAnT-MATLAB

Todos los issues de AllenNeuralDynamics/GIAnT-MATLAB

Issues similares

Más issues de MATLAB

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.