If I add that argument with some value it gets further but there’s more problems, because it doesn’t have access to the right files:
$ files=0
$ isct_antsRegistration \
> --verbose \
> --dimensionality 3 \
> --float 0 \
> --metric 'MeanSquares[fmri_moco_norm_T0000.nii,fmri_moco_norm_T`printf %04d ${files}`.nii,1,32,Regular,0.2]' \
> --output '[X_${files}_,X_${files}_Warped.nii.gz]' \
> --interpolation 'BSpline' \
> --winsorize-image-intensities '[0.005,0.995]' \
> --use-histogram-matching 0 \
> --transform 'Rigid[1]' \
> --shrink-factors 1 \
> --smoothing-sigmas 0 \
> -c 10 \
> -x mask_fmri_65mm.nii
All_Command_lines_OK
Using double precision for computations.
Reading mask(s).
Registration stage 0
file mask_fmri_65mm.nii does not exist .
No fixed mask
number of levels = 1
fixed image: fmri_moco_norm_T0000.nii
moving image: fmri_moco_norm_T`printf %04d ${files}`.nii
file fmri_moco_norm_T0000.nii does not exist .
file fmri_moco_norm_T`printf %04d ${files}`.nii does not exist .
Segmentation fault (core dumped)
This particular error is demonstrating Using isct_ functions because it’s complaining about a file with “%04d” in the filename. We can fix that first:
$ files=0
(venv_sct) [kousu@requiem spinalcordtoolbox]$ isct_antsRegistration \
> --verbose \
> --dimensionality 3 \
> --float 0 \
> --metric 'MeanSquares[fmri_moco_norm_T0000.nii,fmri_moco_norm_T'$(printf %04d ${files})'.nii,1,32,Regular,0.2]' \
> --output '[X_'${files}'_,X_'${files}'_Warped.nii.gz]' \
> --interpolation 'BSpline' \
> --winsorize-image-intensities '[0.005,0.995]' \
> --use-histogram-matching 0 \
> --transform 'Rigid[1]' \
> --shrink-factors 1 \
> --smoothing-sigmas 0 \
> -c 10 \
> -x mask_fmri_65mm.nii
All_Command_lines_OK
Using double precision for computations.
Reading mask(s).
Registration stage 0
file mask_fmri_65mm.nii does not exist .
No fixed mask
number of levels = 1
fixed image: fmri_moco_norm_T0000.nii
moving image: fmri_moco_norm_T0000.nii
file fmri_moco_norm_T0000.nii does not exist .
file fmri_moco_norm_T0000.nii does not exist .
Segmentation fault (core dumped)
Now I need to find some real files to test with. When I ran ./install_sct
I ended up with sct_testing_data/
with a bunch of sample files.
I’ll pick some files out to try to analyse. I don’t know if these files make any sense for the task but they should be enough to get the program to run.
I’ll also do this in a fresh working directory to avoid confusion.
$ mkdir issue346
$ cd issue346/
$ cp ../sct_testing_data/fmri/fmri_r_T0000.nii.gz .
$ ls -l
total 48
-rw-r--r-- 1 kousu kousu 17410 Mar 23 11:32 fmri_r_T0000.nii.gz
$ sha256sum *.nii.gz # just in case you want to verify this work precisely
53693deeecd15ceab11b210c9de10516a186291a18bc3da3cbfa37b2b16bfbff fmri_r_T0000.nii.gz
Now let’s try that command again:
$ files=0
$ isct_antsRegistration \
> --verbose \
> --dimensionality 3 \
> --float 0 \
> --metric 'MeanSquares[fmri_r_T0000.nii.gz,fmri_r_T0000.nii.gz,1,32,Regular,0.2]' \
> --output '[output_issue346,output_issue346_Warped.nii.gz]' \
> --interpolation 'BSpline' \
> --winsorize-image-intensities '[0.005,0.995]' \
> --use-histogram-matching 0 \
> --transform 'Rigid[1]' \
> --shrink-factors 1 \
> --smoothing-sigmas 0 \
> -c 10 \
> -x mask_fmri_65mm.nii
All_Command_lines_OK
Using double precision for computations.
Reading mask(s).
Registration stage 0
file mask_fmri_65mm.nii does not exist .
No fixed mask
number of levels = 1
fixed image: fmri_r_T0000.nii.gz
moving image: fmri_r_T0000.nii.gz
Dimension = 3
Number of stages = 1
Use Histogram Matching false
Winsorize image intensities true
Lower quantile = 0.005
Upper quantile = 0.995
Stage 1 State
Image metric = MeanSquares
Fixed image = Image (0x4f4cbd0)
RTTI typeinfo: itk::Image<double, 3u>
Reference Count: 2
Modified Time: 644
Debug: Off
Object Name:
Observers:
none
Source: (none)
Source output name: (none)
Release Data: Off
Data Released: False
Global Release Data: Off
PipelineMTime: 0
UpdateMTime: 466
RealTimeStamp: 0 seconds
LargestPossibleRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [34, 34, 6]
BufferedRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [34, 34, 6]
RequestedRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [34, 34, 6]
Spacing: [1.91176, 1.91176, 16.8]
Origin: [-29.9549, 34.5494, -23.8665]
Direction:
0.999561 8.49015e-08 0.0296327
0.00222132 -0.997187 -0.0749259
-0.0295494 -0.0749588 0.996749
IndexToPointMatrix:
1.91093 1.62312e-07 0.49783
0.00424664 -1.90639 -1.25876
-0.0564915 -0.143304 16.7454
PointToIndexMatrix:
0.522847 0.00116192 -0.0154566
4.44724e-08 -0.521605 -0.0392092
0.00176385 -0.00445988 0.0593303
Inverse Direction:
0.999561 0.00222132 -0.0295494
8.50207e-08 -0.997187 -0.0749588
0.0296327 -0.0749259 0.996749
PixelContainer:
ImportImageContainer (0x4f42c10)
RTTI typeinfo: itk::ImportImageContainer<unsigned long, double>
Reference Count: 1
Modified Time: 463
Debug: Off
Object Name:
Observers:
none
Pointer: 0x4f55230
Container manages memory: true
Size: 6936
Capacity: 6936
Moving image = Image (0x4f50be0)
RTTI typeinfo: itk::Image<double, 3u>
Reference Count: 2
Modified Time: 645
Debug: Off
Object Name:
Observers:
none
Source: (none)
Source output name: (none)
Release Data: Off
Data Released: False
Global Release Data: Off
PipelineMTime: 0
UpdateMTime: 642
RealTimeStamp: 0 seconds
LargestPossibleRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [34, 34, 6]
BufferedRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [34, 34, 6]
RequestedRegion:
Dimension: 3
Index: [0, 0, 0]
Size: [34, 34, 6]
Spacing: [1.91176, 1.91176, 16.8]
Origin: [-29.9549, 34.5494, -23.8665]
Direction:
0.999561 8.49015e-08 0.0296327
0.00222132 -0.997187 -0.0749259
-0.0295494 -0.0749588 0.996749
IndexToPointMatrix:
1.91093 1.62312e-07 0.49783
0.00424664 -1.90639 -1.25876
-0.0564915 -0.143304 16.7454
PointToIndexMatrix:
0.522847 0.00116192 -0.0154566
4.44724e-08 -0.521605 -0.0392092
0.00176385 -0.00445988 0.0593303
Inverse Direction:
0.999561 0.00222132 -0.0295494
8.50207e-08 -0.997187 -0.0749588
0.0296327 -0.0749259 0.996749
PixelContainer:
ImportImageContainer (0x4f3ecd0)
RTTI typeinfo: itk::ImportImageContainer<unsigned long, double>
Reference Count: 1
Modified Time: 639
Debug: Off
Object Name:
Observers:
none
Pointer: 0x4f65d00
Container manages memory: true
Size: 6936
Capacity: 6936
Weighting = 1
Sampling strategy = regular
Number of bins = 32
Radius = 4
Sampling percentage = 0.2
Transform = Rigid
Gradient step = 1
Update field sigma (voxel space) = 0
Total field sigma (voxel space) = 0
Update field time sigma = 0
Total field time sigma = 0
Number of time indices = 0
Number of time point samples = 0
Registration using 1 total stages.
Stage 0
iterations = 10
convergence threshold = 1e-06
convergence window size = 10
number of levels = 1
using the MeanSquares metric (weight = 1)
preprocessing: winsorizing the image intensities
Shrink factors (level 1 out of 1): [1, 1, 1]
smoothing sigmas per level: [0]
regular sampling (percentage = 0.2)
*** Running Euler3DTransform registration ***
DIAGNOSTIC,Iteration,metricValue,convergenceValue,ITERATION_TIME_INDEX,SINCE_LAST
2DIAGNOSTIC, 1, 0.000000000000e+00, 1.797693134862e+308, 6.6512e-03, 6.6512e-03,
2DIAGNOSTIC, 2, 0.000000000000e+00, 1.797693134862e+308, 8.3532e-03, 1.7021e-03,
2DIAGNOSTIC, 3, 0.000000000000e+00, 1.797693134862e+308, 1.0092e-02, 1.7390e-03,
2DIAGNOSTIC, 4, 0.000000000000e+00, 1.797693134862e+308, 1.1875e-02, 1.7829e-03,
2DIAGNOSTIC, 5, 0.000000000000e+00, 1.797693134862e+308, 1.3513e-02, 1.6379e-03,
2DIAGNOSTIC, 6, 0.000000000000e+00, 1.797693134862e+308, 1.5179e-02, 1.6661e-03,
2DIAGNOSTIC, 7, 0.000000000000e+00, 1.797693134862e+308, 1.6851e-02, 1.6720e-03,
2DIAGNOSTIC, 8, 0.000000000000e+00, 1.797693134862e+308, 1.8378e-02, 1.5271e-03,
2DIAGNOSTIC, 9, 0.000000000000e+00, 1.797693134862e+308, 1.9923e-02, 1.5450e-03,
Elapsed time (stage 0): 2.2582e-02
Total elapsed time: 2.3342e-02
This produced two new files:
$ ls -l
total 80
-rw-r--r-- 1 kousu kousu 17410 Mar 23 11:32 fmri_r_T0000.nii.gz
-rw-r--r-- 1 kousu kousu 193 Mar 23 11:35 output_issue3460GenericAffine.mat
-rw-r--r-- 1 kousu kousu 27998 Mar 23 11:35 output_issue346_Warped.nii.gz
It seems to have ignored the mask, like you suggested.