[BUG]: Mask "inherit" will be warped twice if working in native space. #284

Merged
synchon merged 6 commits from fix/inherit-mask-single-warp into main 2024-01-15 08:45:34 +00:00
synchon commented 2023-12-14 11:52:16 +00:00 (Migrated from github.com)

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm running a pipeline in which we use warp data to native space. The second preprocessing step is doing confound removal, while using a GM mask. The markers have mask="inherit", so the same GM mask is used. What I see in the log is that the mask is warped twice, so in the end, it does not fit the subject's images and many voxels are not considered as part of the GM.

Expected Behavior

I expect the "inherited" mask not to be warped twice, since it's already warped in the preprocessing step.

Steps To Reproduce

  1. Install junifer from main branch.
  2. Run something like this:
workdir: /tmp

with:
  - ../external/juni-farm/juni_farm/datagrabber/hcp_ya_confounds_cat.py

datagrabber:
    kind: MultipleHCP
    ica_fix: true
    tasks:
      - REST1
      - REST2

preprocess:
  - kind: BOLDWarper
    reference: T1w
  - kind: fMRIPrepConfoundRemover
    detrend: true
    standardize: true
    strategy:
        wm_csf: full
        global_signal: full
    low_pass: 0.08
    high_pass: 0.01
    masks:
      - fetch_icbm152_brain_gm_mask

markers:

  - name: ReHo-SphereSize-5mm_native
    kind: ReHoSpheres
    coords: "Power"
    radius: 5
    use_afni: true
    allow_overlap: true
    agg_method: count
    masks: 
      - inherit
  1. Run the same, but replace the inherit for fetch_icbm152_brain_gm_mask in the marker. Check the output, it should be the same.

Environment

junifer:
  version: 0.0.3.dev101
python:
  version: 3.11.3
  implementation: CPython
dependencies:
  click: 8.0.4
  numpy: 1.23.5
  datalad: 0.18.2+59.gc5054cb91
  pandas: 1.5.3
  nibabel: 4.0.2
  nilearn: 0.10.0
  sqlalchemy: 1.4.48
  ruamel.yaml: 0.17.31
system:
  platform: Linux-6.1.0-12-amd64-x86_64-with-glibc2.36
environment:
  LC_CTYPE: en_US.UTF-8
  PATH: 
    /home/fraimondo/miniconda3/envs/junifer/bin:/home/fraimondo/miniconda3/condabin:/home/fraimondo/.dotfiles/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/local/games:/usr/games

Relevant log output

2023-12-13 16:59:59,227 - JUNIFER - INFO - ===== Lib Versions =====                                        
2023-12-13 16:59:59,227 - JUNIFER - INFO - numpy: 1.23.5                                                   
2023-12-13 16:59:59,227 - JUNIFER - INFO - scipy: 1.10.1                                                   
2023-12-13 16:59:59,227 - JUNIFER - INFO - pandas: 1.5.3                                                   
2023-12-13 16:59:59,228 - JUNIFER - INFO - nilearn: 0.10.0                                                 
2023-12-13 16:59:59,228 - JUNIFER - INFO - nibabel: 4.0.2                                                  
2023-12-13 16:59:59,228 - JUNIFER - INFO - junifer: 0.0.3.dev101                                           
2023-12-13 16:59:59,228 - JUNIFER - INFO - ========================                                        
2023-12-13 16:59:59,259 - JUNIFER - INFO - Preprocessing BOLD                                              
2023-12-13 16:59:59,259 - JUNIFER - DEBUG - Extra input for preprocess: dict_keys(['T1w', 'Warp', 'BOLD_con
founds'])                                                                                                  
2023-12-13 17:00:37,317 - JUNIFER - INFO - No `t_r` specified, using t_r from nifti header                 
2023-12-13 17:00:37,317 - JUNIFER - INFO - Read t_r from nifti header: 0.7200000286102295                  
2023-12-13 17:00:37,317 - JUNIFER - DEBUG - Masking with fetch_icbm152_brain_gm_mask                       
2023-12-13 17:00:37,723 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14                                                                          
2023-12-13 17:00:37,731 - JUNIFER - DEBUG - Creating element temporary directory at /home/fraimondo/dev/scr
atch/test_junifer_native/temp/tmpz0e9c9gs                                                                  
2023-12-13 17:00:37,734 - JUNIFER - INFO - applywarp command to be executed: applywarp --interp=nn -i /home
/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu/prewarp_mask.nii.gz -r /home/frai
mondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz -w /hom
e/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/object
s/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f0
1a7.nii.gz -o /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx/mask_warped.ni
i.gz  
2023-12-13 17:00:40,433 - JUNIFER - INFO - applywarp succeeded with the following output: b'/home/fraimondo
/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu/prewarp_mask.nii.gz is a file\n/home/fraimo
ndo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz is a file
\n/home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/
objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e
1270f01a7.nii.gz is a file\n/home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx/
mask_warped.nii.gz is a prefix\nSingularity args: --bind /home/fraimondo/dev/scratch/test_junifer_native/te
mp/tmpv1yu9n14/masks0f3ar3gu:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph
9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bind /home/fraimondo/test_datasets/human-connectome-project-opena
ccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.
nii.gz:/data/mount_3 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx:
/data/mount_4\nCorrected args for FSL: applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz -r /data/
mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz 
-o /data/mount_4/mask_warped.nii.gz\nRunning command: /data/group/appliedml/tools/fsl_6.0.4-patched2/singul
arity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu:/data/
mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mou
nt_2 --bind /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.
git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx:/data/mount_4 /data/group/appliedml
/tools/fsl_6.0.4-patched2/fsl_6.0.4-patched2.sif applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz
 -r /data/mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01
a7.nii.gz -o /data/mount_4/mask_warped.nii.gz\n'                                                           
2023-12-13 17:00:40,434 - JUNIFER - DEBUG - Deleting temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu                                                            
2023-12-13 17:00:40,434 - JUNIFER - DEBUG - Setting mask_item                                              
2023-12-13 17:00:40,434 - JUNIFER - INFO - Cleaning image                                                  
2023-12-13 17:00:40,434 - JUNIFER - DEBUG -     detrend: True                                              
2023-12-13 17:00:40,434 - JUNIFER - DEBUG -     standardize: True                                          
2023-12-13 17:00:40,434 - JUNIFER - DEBUG -     low_pass: 0.08                                             
2023-12-13 17:00:40,434 - JUNIFER - DEBUG -     high_pass: 0.01                                            
2023-12-13 17:01:06,601 - JUNIFER - DEBUG - Adding BOLD to output                                                                                                    
2023-12-13 17:01:12,059 - JUNIFER - INFO - Computing BOLD                                                  
2023-12-13 17:01:12,059 - JUNIFER - INFO - Calculating ReHo for spheres.                                   
2023-12-13 17:01:12,059 - JUNIFER - INFO - Calculating ReHO map.                                           
2023-12-13 17:01:12,059 - JUNIFER - INFO - Using ReHo map cache at /home/fraimondo/test_datasets/human-conn
ectome-project-openaccess/HCP1200/100307/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_hp2000_clean.ni
i.gz.                                                                                                      
2023-12-13 17:01:12,059 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14                                                                          
2023-12-13 17:01:16,869 - JUNIFER - INFO - 3dReHo command to be executed: 3dReHo -prefix /home/fraimondo/de
v/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m/reho -inset /home/fraimondo/dev/scratch/test_ju
nifer_native/temp/tmpv1yu9n14/rehodt5otw4m/input.nii -nneigh 27                                            
2023-12-13 17:02:02,784 - JUNIFER - INFO - 3dReHo succeeded with the following output: b"/home/fraimondo/de
v/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m/reho is a prefix\n/home/fraimondo/dev/scratch/t
est_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m/input.nii is a file\nSingularity args: --bind /home/fraimo
ndo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_1 --bind /home/fraimondo/dev/
scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_2\nCorrected args for AFNI: 3dReHo -p
refix /data/mount_1/reho -inset /data/mount_2/input.nii -nneigh 27\nRunning command: /data/group/appliedml/
tools/afni_23.1.10/singularity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu
9n14/rehodt5otw4m:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/reh
odt5otw4m:/data/mount_2 /data/group/appliedml/tools/afni_23.1.10/afni_make_build_AFNI_23.1.10.sif 3dReHo -p
refix /data/mount_1/reho -inset /data/mount_2/input.nii -nneigh 27\n++ Final vox neighborhood: ellipsoid wi
th Nneigh=27 and radii (1.900,1.900,1.900).\n++ ReHo (Kendall's W) calculated.\n"
2023-12-13 17:02:02,786 - JUNIFER - INFO - 3dAFNItoNIFTI command to be executed: 3dAFNItoNIFTI -prefix /hom
e/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c8cc53239c292
660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1y
u9n14/rehodt5otw4m/reho+tlrc.BRIK                                                                          
2023-12-13 17:02:03,004 - JUNIFER - INFO - 3dAFNItoNIFTI succeeded with the following output: b'/home/fraim
ondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c8cc53239c292660732b
8932024b2b8c347bc4549620d0f5aec38cd6.nii is a prefix\n/home/fraimondo/dev/scratch/test_junifer_native/temp/
tmpv1yu9n14/rehodt5otw4m/reho+tlrc.BRIK is a file\nSingularity args: --bind /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_j
unifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_2\nCorrected args for AFNI: 3dAFNItoNIFTI -prefix /
data/mount_1/output_9e864993c8cc53239c292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii /data/mount_2/reho
+tlrc.BRIK\nRunning command: /data/group/appliedml/tools/afni_23.1.10/singularity_cmd exec --bind /home/fra
imondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 --bind /home/fraimo
ndo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_2 /data/group/appliedml/tools
/afni_23.1.10/afni_make_build_AFNI_23.1.10.sif 3dAFNItoNIFTI -prefix /data/mount_1/output_9e864993c8cc53239
c292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii /data/mount_2/reho+tlrc.BRIK\n++ 3dAFNItoNIFTI: AFNI ve
rsion=AFNI_23.1.10 (Jun 30 2023) [64-bit]\n'                                                               
2023-12-13 17:02:03,010 - JUNIFER - DEBUG - Sphere aggregation using count                                 
2023-12-13 17:02:03,010 - JUNIFER - WARNING - `Power` has been replaced with `Power2011` and will be remove
d in the next release. For now, it's available for backward compatibility.                                 
2023-12-13 17:02:03,014 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14                                                                          
2023-12-13 17:02:03,020 - JUNIFER - DEBUG - Creating element temporary directory at /home/fraimondo/dev/scr
atch/test_junifer_native/temp/tmpz0e9c9gs                                                                  
2023-12-13 17:02:03,025 - JUNIFER - INFO - img2imgcoord command to be executed: cat /home/fraimondo/dev/scr
atch/test_junifer_native/temp/tmpv1yu9n14/coordinatesj3qdk4wz/pretransform_coordinates.txt | img2imgcoord -
mm -src /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c
8cc53239c292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii -dest /home/fraimondo/dev/scratch/test_junifer_
native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz -warp /home/fraimondo/test_datasets/hu
man-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2a
fc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz > /home/fraimondo
/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/coordinates1vx7cf_h/coordinates_transformed.txt; sed -i 1
d /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/coordinates1vx7cf_h/coordinates_transfor
med.txt                                                                                                    
2023-12-13 17:02:14,398 - JUNIFER - INFO - img2imgcoord succeeded with the following output: b'/home/fraimo
ndo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c8cc53239c292660732b8
932024b2b8c347bc4549620d0f5aec38cd6.nii is a file\n/home/fraimondo/dev/scratch/test_junifer_native/temp/tmp
h9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz is a file\n/home/fraimondo/test_datasets/human-connec
tome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b96
5d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz is a file\nSingularity args
: --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 -
-bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bi
nd /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex
/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3\nCorrected args for FSL
: img2imgcoord -mm -src /data/mount_1/output_9e864993c8cc53239c292660732b8932024b2b8c347bc4549620d0f5aec38c
d6.nii -dest /data/mount_2/reference_resampled.nii.gz -warp /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d8
3048e1270f01a7.nii.gz\nRunning command: /data/group/appliedml/tools/fsl_6.0.4-patched2/singularity_cmd exec
 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 --
bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bind /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/
objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3 /data/group/appliedml/to
ols/fsl_6.0.4-patched2/fsl_6.0.4-patched2.sif img2imgcoord -mm -src /data/mount_1/output_9e864993c8cc53239c
292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii -dest /data/mount_2/reference_resampled.nii.gz -warp /da
ta/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz\n'    
2023-12-13 17:02:14,399 - JUNIFER - DEBUG - Deleting temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14/coordinatesj3qdk4wz                                                      
2023-12-13 17:02:14,399 - JUNIFER - DEBUG - Masking with inherit                                           
2023-12-13 17:02:14,399 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14                                                                          
2023-12-13 17:02:14,422 - JUNIFER - DEBUG - Creating element temporary directory at /home/fraimondo/dev/scr
atch/test_junifer_native/temp/tmpz0e9c9gs                                                                  
2023-12-13 17:02:14,424 - JUNIFER - INFO - applywarp command to be executed: applywarp --interp=nn -i /home
/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd/prewarp_mask.nii.gz -r /home/frai
mondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz -w /hom
e/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/object
s/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f0
1a7.nii.gz -o /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d/mask_warped.ni
i.gz                                                                                                       
2023-12-13 17:02:17,172 - JUNIFER - INFO - applywarp succeeded with the following output: b'/home/fraimondo
/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd/prewarp_mask.nii.gz is a file\n/home/fraimo
ndo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz is a file
\n/home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/
objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e
1270f01a7.nii.gz is a file\n/home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d/
mask_warped.nii.gz is a prefix\nSingularity args: --bind /home/fraimondo/dev/scratch/test_junifer_native/te
mp/tmpv1yu9n14/masksxd08mqmd:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph
9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bind /home/fraimondo/test_datasets/human-connectome-project-opena
ccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.
nii.gz:/data/mount_3 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d:
/data/mount_4\nCorrected args for FSL: applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz -r /data/
mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz 
-o /data/mount_4/mask_warped.nii.gz\nRunning command: /data/group/appliedml/tools/fsl_6.0.4-patched2/singul
arity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd:/data/
mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mou
nt_2 --bind /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.
git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3 --bind /home/f
raimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d:/data/mount_4 /data/group/appliedml
/tools/fsl_6.0.4-patched2/fsl_6.0.4-patched2.sif applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz
 -r /data/mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01
a7.nii.gz -o /data/mount_4/mask_warped.nii.gz\n'                                                           
2023-12-13 17:02:17,173 - JUNIFER - DEBUG - Deleting temporary directory at /home/fraimondo/dev/scratch/tes
t_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd                                                            
2023-12-13 17:02:17,174 - JUNIFER - DEBUG - Masking                                                        
2023-12-13 17:02:18,498 - JUNIFER - INFO - No storage specified, returning dictionary

Anything else?

Log at 17:00:40 shows the first warping
Log at 17:02:14 shows the second warping.

Error is here:

github.com/juaml/junifer@01055e80cc/junifer/data/masks.py (L337-L338)

We are basically warping if the target data is in "native" space. We should be warping ONLY if the mask is not in the target data's space.

We also need to set the space here:

github.com/juaml/junifer@01055e80cc/junifer/preprocess/confounds/fmriprep_confound_remover.py (L577)

### Is there an existing issue for this? - [X] I have searched the existing issues ### Current Behavior I'm running a pipeline in which we use warp data to native space. The second preprocessing step is doing confound removal, while using a GM mask. The markers have `mask="inherit"`, so the same GM mask is used. What I see in the log is that the mask is warped twice, so in the end, it does not fit the subject's images and many voxels are not considered as part of the GM. ### Expected Behavior I expect the "inherited" mask not to be warped twice, since it's already warped in the preprocessing step. ### Steps To Reproduce 1. Install junifer from main branch. 2. Run something like this: ``` workdir: /tmp with: - ../external/juni-farm/juni_farm/datagrabber/hcp_ya_confounds_cat.py datagrabber: kind: MultipleHCP ica_fix: true tasks: - REST1 - REST2 preprocess: - kind: BOLDWarper reference: T1w - kind: fMRIPrepConfoundRemover detrend: true standardize: true strategy: wm_csf: full global_signal: full low_pass: 0.08 high_pass: 0.01 masks: - fetch_icbm152_brain_gm_mask markers: - name: ReHo-SphereSize-5mm_native kind: ReHoSpheres coords: "Power" radius: 5 use_afni: true allow_overlap: true agg_method: count masks: - inherit ``` 3. Run the same, but replace the `inherit` for `fetch_icbm152_brain_gm_mask` in the marker. Check the output, it should be the same. ### Environment ```markdown junifer: version: 0.0.3.dev101 python: version: 3.11.3 implementation: CPython dependencies: click: 8.0.4 numpy: 1.23.5 datalad: 0.18.2+59.gc5054cb91 pandas: 1.5.3 nibabel: 4.0.2 nilearn: 0.10.0 sqlalchemy: 1.4.48 ruamel.yaml: 0.17.31 system: platform: Linux-6.1.0-12-amd64-x86_64-with-glibc2.36 environment: LC_CTYPE: en_US.UTF-8 PATH: /home/fraimondo/miniconda3/envs/junifer/bin:/home/fraimondo/miniconda3/condabin:/home/fraimondo/.dotfiles/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/local/games:/usr/games ``` ### Relevant log output ```shell 2023-12-13 16:59:59,227 - JUNIFER - INFO - ===== Lib Versions ===== 2023-12-13 16:59:59,227 - JUNIFER - INFO - numpy: 1.23.5 2023-12-13 16:59:59,227 - JUNIFER - INFO - scipy: 1.10.1 2023-12-13 16:59:59,227 - JUNIFER - INFO - pandas: 1.5.3 2023-12-13 16:59:59,228 - JUNIFER - INFO - nilearn: 0.10.0 2023-12-13 16:59:59,228 - JUNIFER - INFO - nibabel: 4.0.2 2023-12-13 16:59:59,228 - JUNIFER - INFO - junifer: 0.0.3.dev101 2023-12-13 16:59:59,228 - JUNIFER - INFO - ======================== 2023-12-13 16:59:59,259 - JUNIFER - INFO - Preprocessing BOLD 2023-12-13 16:59:59,259 - JUNIFER - DEBUG - Extra input for preprocess: dict_keys(['T1w', 'Warp', 'BOLD_con founds']) 2023-12-13 17:00:37,317 - JUNIFER - INFO - No `t_r` specified, using t_r from nifti header 2023-12-13 17:00:37,317 - JUNIFER - INFO - Read t_r from nifti header: 0.7200000286102295 2023-12-13 17:00:37,317 - JUNIFER - DEBUG - Masking with fetch_icbm152_brain_gm_mask 2023-12-13 17:00:37,723 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14 2023-12-13 17:00:37,731 - JUNIFER - DEBUG - Creating element temporary directory at /home/fraimondo/dev/scr atch/test_junifer_native/temp/tmpz0e9c9gs 2023-12-13 17:00:37,734 - JUNIFER - INFO - applywarp command to be executed: applywarp --interp=nn -i /home /fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu/prewarp_mask.nii.gz -r /home/frai mondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz -w /hom e/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/object s/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f0 1a7.nii.gz -o /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx/mask_warped.ni i.gz 2023-12-13 17:00:40,433 - JUNIFER - INFO - applywarp succeeded with the following output: b'/home/fraimondo /dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu/prewarp_mask.nii.gz is a file\n/home/fraimo ndo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz is a file \n/home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/ objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e 1270f01a7.nii.gz is a file\n/home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx/ mask_warped.nii.gz is a prefix\nSingularity args: --bind /home/fraimondo/dev/scratch/test_junifer_native/te mp/tmpv1yu9n14/masks0f3ar3gu:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph 9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bind /home/fraimondo/test_datasets/human-connectome-project-opena ccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7. nii.gz:/data/mount_3 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx: /data/mount_4\nCorrected args for FSL: applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz -r /data/ mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz -o /data/mount_4/mask_warped.nii.gz\nRunning command: /data/group/appliedml/tools/fsl_6.0.4-patched2/singul arity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu:/data/ mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mou nt_2 --bind /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/. git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskspqismabx:/data/mount_4 /data/group/appliedml /tools/fsl_6.0.4-patched2/fsl_6.0.4-patched2.sif applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz -r /data/mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01 a7.nii.gz -o /data/mount_4/mask_warped.nii.gz\n' 2023-12-13 17:00:40,434 - JUNIFER - DEBUG - Deleting temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14/masks0f3ar3gu 2023-12-13 17:00:40,434 - JUNIFER - DEBUG - Setting mask_item 2023-12-13 17:00:40,434 - JUNIFER - INFO - Cleaning image 2023-12-13 17:00:40,434 - JUNIFER - DEBUG - detrend: True 2023-12-13 17:00:40,434 - JUNIFER - DEBUG - standardize: True 2023-12-13 17:00:40,434 - JUNIFER - DEBUG - low_pass: 0.08 2023-12-13 17:00:40,434 - JUNIFER - DEBUG - high_pass: 0.01 2023-12-13 17:01:06,601 - JUNIFER - DEBUG - Adding BOLD to output 2023-12-13 17:01:12,059 - JUNIFER - INFO - Computing BOLD 2023-12-13 17:01:12,059 - JUNIFER - INFO - Calculating ReHo for spheres. 2023-12-13 17:01:12,059 - JUNIFER - INFO - Calculating ReHO map. 2023-12-13 17:01:12,059 - JUNIFER - INFO - Using ReHo map cache at /home/fraimondo/test_datasets/human-conn ectome-project-openaccess/HCP1200/100307/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_hp2000_clean.ni i.gz. 2023-12-13 17:01:12,059 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14 2023-12-13 17:01:16,869 - JUNIFER - INFO - 3dReHo command to be executed: 3dReHo -prefix /home/fraimondo/de v/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m/reho -inset /home/fraimondo/dev/scratch/test_ju nifer_native/temp/tmpv1yu9n14/rehodt5otw4m/input.nii -nneigh 27 2023-12-13 17:02:02,784 - JUNIFER - INFO - 3dReHo succeeded with the following output: b"/home/fraimondo/de v/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m/reho is a prefix\n/home/fraimondo/dev/scratch/t est_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m/input.nii is a file\nSingularity args: --bind /home/fraimo ndo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_1 --bind /home/fraimondo/dev/ scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_2\nCorrected args for AFNI: 3dReHo -p refix /data/mount_1/reho -inset /data/mount_2/input.nii -nneigh 27\nRunning command: /data/group/appliedml/ tools/afni_23.1.10/singularity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu 9n14/rehodt5otw4m:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/reh odt5otw4m:/data/mount_2 /data/group/appliedml/tools/afni_23.1.10/afni_make_build_AFNI_23.1.10.sif 3dReHo -p refix /data/mount_1/reho -inset /data/mount_2/input.nii -nneigh 27\n++ Final vox neighborhood: ellipsoid wi th Nneigh=27 and radii (1.900,1.900,1.900).\n++ ReHo (Kendall's W) calculated.\n" 2023-12-13 17:02:02,786 - JUNIFER - INFO - 3dAFNItoNIFTI command to be executed: 3dAFNItoNIFTI -prefix /hom e/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c8cc53239c292 660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1y u9n14/rehodt5otw4m/reho+tlrc.BRIK 2023-12-13 17:02:03,004 - JUNIFER - INFO - 3dAFNItoNIFTI succeeded with the following output: b'/home/fraim ondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c8cc53239c292660732b 8932024b2b8c347bc4549620d0f5aec38cd6.nii is a prefix\n/home/fraimondo/dev/scratch/test_junifer_native/temp/ tmpv1yu9n14/rehodt5otw4m/reho+tlrc.BRIK is a file\nSingularity args: --bind /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_j unifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_2\nCorrected args for AFNI: 3dAFNItoNIFTI -prefix / data/mount_1/output_9e864993c8cc53239c292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii /data/mount_2/reho +tlrc.BRIK\nRunning command: /data/group/appliedml/tools/afni_23.1.10/singularity_cmd exec --bind /home/fra imondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 --bind /home/fraimo ndo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/rehodt5otw4m:/data/mount_2 /data/group/appliedml/tools /afni_23.1.10/afni_make_build_AFNI_23.1.10.sif 3dAFNItoNIFTI -prefix /data/mount_1/output_9e864993c8cc53239 c292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii /data/mount_2/reho+tlrc.BRIK\n++ 3dAFNItoNIFTI: AFNI ve rsion=AFNI_23.1.10 (Jun 30 2023) [64-bit]\n' 2023-12-13 17:02:03,010 - JUNIFER - DEBUG - Sphere aggregation using count 2023-12-13 17:02:03,010 - JUNIFER - WARNING - `Power` has been replaced with `Power2011` and will be remove d in the next release. For now, it's available for backward compatibility. 2023-12-13 17:02:03,014 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14 2023-12-13 17:02:03,020 - JUNIFER - DEBUG - Creating element temporary directory at /home/fraimondo/dev/scr atch/test_junifer_native/temp/tmpz0e9c9gs 2023-12-13 17:02:03,025 - JUNIFER - INFO - img2imgcoord command to be executed: cat /home/fraimondo/dev/scr atch/test_junifer_native/temp/tmpv1yu9n14/coordinatesj3qdk4wz/pretransform_coordinates.txt | img2imgcoord - mm -src /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c 8cc53239c292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii -dest /home/fraimondo/dev/scratch/test_junifer_ native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz -warp /home/fraimondo/test_datasets/hu man-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2a fc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz > /home/fraimondo /dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/coordinates1vx7cf_h/coordinates_transformed.txt; sed -i 1 d /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/coordinates1vx7cf_h/coordinates_transfor med.txt 2023-12-13 17:02:14,398 - JUNIFER - INFO - img2imgcoord succeeded with the following output: b'/home/fraimo ndo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss/output_9e864993c8cc53239c292660732b8 932024b2b8c347bc4549620d0f5aec38cd6.nii is a file\n/home/fraimondo/dev/scratch/test_junifer_native/temp/tmp h9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz is a file\n/home/fraimondo/test_datasets/human-connec tome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b96 5d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz is a file\nSingularity args : --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 - -bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bi nd /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex /objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3\nCorrected args for FSL : img2imgcoord -mm -src /data/mount_1/output_9e864993c8cc53239c292660732b8932024b2b8c347bc4549620d0f5aec38c d6.nii -dest /data/mount_2/reference_resampled.nii.gz -warp /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d8 3048e1270f01a7.nii.gz\nRunning command: /data/group/appliedml/tools/fsl_6.0.4-patched2/singularity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/reho_afni2sopr5ss:/data/mount_1 -- bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bind /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/ objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3 /data/group/appliedml/to ols/fsl_6.0.4-patched2/fsl_6.0.4-patched2.sif img2imgcoord -mm -src /data/mount_1/output_9e864993c8cc53239c 292660732b8932024b2b8c347bc4549620d0f5aec38cd6.nii -dest /data/mount_2/reference_resampled.nii.gz -warp /da ta/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz\n' 2023-12-13 17:02:14,399 - JUNIFER - DEBUG - Deleting temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14/coordinatesj3qdk4wz 2023-12-13 17:02:14,399 - JUNIFER - DEBUG - Masking with inherit 2023-12-13 17:02:14,399 - JUNIFER - DEBUG - Creating temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14 2023-12-13 17:02:14,422 - JUNIFER - DEBUG - Creating element temporary directory at /home/fraimondo/dev/scr atch/test_junifer_native/temp/tmpz0e9c9gs 2023-12-13 17:02:14,424 - JUNIFER - INFO - applywarp command to be executed: applywarp --interp=nn -i /home /fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd/prewarp_mask.nii.gz -r /home/frai mondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz -w /hom e/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/object s/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e1270f0 1a7.nii.gz -o /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d/mask_warped.ni i.gz 2023-12-13 17:02:17,172 - JUNIFER - INFO - applywarp succeeded with the following output: b'/home/fraimondo /dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd/prewarp_mask.nii.gz is a file\n/home/fraimo ndo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8/reference_resampled.nii.gz is a file \n/home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/.git/annex/ objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz/MD5E-s8671773--cba2afc2eef7b965d83048e 1270f01a7.nii.gz is a file\n/home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d/ mask_warped.nii.gz is a prefix\nSingularity args: --bind /home/fraimondo/dev/scratch/test_junifer_native/te mp/tmpv1yu9n14/masksxd08mqmd:/data/mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph 9ne4d1v/applywarpwe3rtzw8:/data/mount_2 --bind /home/fraimondo/test_datasets/human-connectome-project-opena ccess/HCP1200/100307/MNINonLinear/.git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7. nii.gz:/data/mount_3 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d: /data/mount_4\nCorrected args for FSL: applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz -r /data/ mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz -o /data/mount_4/mask_warped.nii.gz\nRunning command: /data/group/appliedml/tools/fsl_6.0.4-patched2/singul arity_cmd exec --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd:/data/ mount_1 --bind /home/fraimondo/dev/scratch/test_junifer_native/temp/tmph9ne4d1v/applywarpwe3rtzw8:/data/mou nt_2 --bind /home/fraimondo/test_datasets/human-connectome-project-openaccess/HCP1200/100307/MNINonLinear/. git/annex/objects/8Z/gf/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01a7.nii.gz:/data/mount_3 --bind /home/f raimondo/dev/scratch/test_junifer_native/temp/tmpz0e9c9gs/maskszcxnzh5d:/data/mount_4 /data/group/appliedml /tools/fsl_6.0.4-patched2/fsl_6.0.4-patched2.sif applywarp --interp=nn -i /data/mount_1/prewarp_mask.nii.gz -r /data/mount_2/reference_resampled.nii.gz -w /data/mount_3/MD5E-s8671773--cba2afc2eef7b965d83048e1270f01 a7.nii.gz -o /data/mount_4/mask_warped.nii.gz\n' 2023-12-13 17:02:17,173 - JUNIFER - DEBUG - Deleting temporary directory at /home/fraimondo/dev/scratch/tes t_junifer_native/temp/tmpv1yu9n14/masksxd08mqmd 2023-12-13 17:02:17,174 - JUNIFER - DEBUG - Masking 2023-12-13 17:02:18,498 - JUNIFER - INFO - No storage specified, returning dictionary ``` ### Anything else? Log at 17:00:40 shows the first warping Log at 17:02:14 shows the second warping. Error is here: https://github.com/juaml/junifer/blob/01055e80cc5a4872e0deae0523800a3ca5a647e5/junifer/data/masks.py#L337-L338 We are basically warping if the target data is in "native" space. We should be warping ONLY if the mask is not in the target data's space. We also need to set the space here: https://github.com/juaml/junifer/blob/01055e80cc5a4872e0deae0523800a3ca5a647e5/junifer/preprocess/confounds/fmriprep_confound_remover.py#L577
github-actions[bot] commented 2023-12-14 11:58:26 +00:00 (Migrated from github.com)
PR Preview Action v1.4.6
Preview removed because the pull request was closed.
2024-01-15 08:50 UTC
[PR Preview Action](https://github.com/rossjrw/pr-preview-action) v1.4.6 :---: Preview removed because the pull request was closed. 2024-01-15 08:50 UTC <!-- Sticky Pull Request Commentpr-preview -->
codecov[bot] commented 2023-12-14 11:59:14 +00:00 (Migrated from github.com)

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (4d9e509) 89.45% compared to head (8e27ca2) 89.46%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #284      +/-   ##
==========================================
+ Coverage   89.45%   89.46%   +0.01%     
==========================================
  Files          98       98              
  Lines        4410     4415       +5     
  Branches      850      850              
==========================================
+ Hits         3945     3950       +5     
  Misses        323      323              
  Partials      142      142              
Flag Coverage Δ
docs 100.00% <ø> (ø)
junifer 89.46% <90.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../preprocess/confounds/fmriprep_confound_remover.py 98.78% <100.00%> (ø)
junifer/data/masks.py 83.33% <88.88%> (+0.59%) ⬆️
## [Codecov](https://app.codecov.io/gh/juaml/junifer/pull/284?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) Report Attention: `1 lines` in your changes are missing coverage. Please review. > Comparison is base [(`4d9e509`)](https://app.codecov.io/gh/juaml/junifer/commit/4d9e509c1664da703d07a4082143aee6f6c24944?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) 89.45% compared to head [(`8e27ca2`)](https://app.codecov.io/gh/juaml/junifer/pull/284?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) 89.46%. <details><summary>Additional details and impacted files</summary> [![Impacted file tree graph](https://app.codecov.io/gh/juaml/junifer/pull/284/graphs/tree.svg?width=650&height=150&src=pr&token=5H21JuZXMw&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml)](https://app.codecov.io/gh/juaml/junifer/pull/284?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) ```diff @@ Coverage Diff @@ ## main #284 +/- ## ========================================== + Coverage 89.45% 89.46% +0.01% ========================================== Files 98 98 Lines 4410 4415 +5 Branches 850 850 ========================================== + Hits 3945 3950 +5 Misses 323 323 Partials 142 142 ``` | [Flag](https://app.codecov.io/gh/juaml/junifer/pull/284/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) | Coverage Δ | | |---|---|---| | [docs](https://app.codecov.io/gh/juaml/junifer/pull/284/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) | `100.00% <ø> (ø)` | | | [junifer](https://app.codecov.io/gh/juaml/junifer/pull/284/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) | `89.46% <90.00%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/juaml/junifer/pull/284?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml) | Coverage Δ | | |---|---|---| | [.../preprocess/confounds/fmriprep\_confound\_remover.py](https://app.codecov.io/gh/juaml/junifer/pull/284?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml#diff-anVuaWZlci9wcmVwcm9jZXNzL2NvbmZvdW5kcy9mbXJpcHJlcF9jb25mb3VuZF9yZW1vdmVyLnB5) | `98.78% <100.00%> (ø)` | | | [junifer/data/masks.py](https://app.codecov.io/gh/juaml/junifer/pull/284?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=juaml#diff-anVuaWZlci9kYXRhL21hc2tzLnB5) | `83.33% <88.88%> (+0.59%)` | :arrow_up: | </details>
fraimondo (Migrated from github.com) reviewed 2024-01-11 11:38:34 +00:00
@ -323,3 +328,4 @@
f"Masks are in different spaces: {unique_spaces}, "
"unable to merge."
),
klass=RuntimeError,
fraimondo (Migrated from github.com) commented 2023-12-14 11:55:42 +00:00

I do not follow here the logic. Why we do not consider "inherit" in "filtered spaces"? Indeed inherit should be replaced by the space of the "inherited" mask, no?

I do not follow here the logic. Why we do not consider "inherit" in "filtered spaces"? Indeed inherit should be replaced by the space of the "inherited" mask, no?
synchon (Migrated from github.com) reviewed 2024-01-11 11:41:40 +00:00
@ -323,3 +328,4 @@
f"Masks are in different spaces: {unique_spaces}, "
"unable to merge."
),
klass=RuntimeError,
synchon (Migrated from github.com) commented 2024-01-11 11:41:40 +00:00

We need to check actual space and not "inherit" coz we get the unique ones by making a set out of the spaces and inherit doesn't make sense there. That's a fair point that the space of the inherited mask should be replaced, will take a look.

We need to check actual space and not "inherit" coz we get the unique ones by making a set out of the spaces and inherit doesn't make sense there. That's a fair point that the space of the inherited mask should be replaced, will take a look.
synchon (Migrated from github.com) reviewed 2024-01-12 10:19:53 +00:00
@ -323,3 +328,4 @@
f"Masks are in different spaces: {unique_spaces}, "
"unable to merge."
),
klass=RuntimeError,
synchon (Migrated from github.com) commented 2024-01-12 10:19:53 +00:00

So I've updated the logic to check for correct target space and do away with "inherit".

So I've updated the logic to check for correct target space and do away with "inherit".
fraimondo (Migrated from github.com) approved these changes 2024-01-12 10:58:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
juaml/junifer!284
No description provided.