ivadomed / canproco

Code for preprocessing the CanProCo brain and spinal cord dataset
MIT License
4 stars 1 forks source link

Create code to linearly register SC lesion masks in subject PSIR to subject MT space and calculate MTR for ROIs excluding SC lesions #91

Open jcohenadad opened 6 months ago

jcohenadad commented 6 months ago

This issue is a followup from https://github.com/ivadomed/canproco/issues/88#issuecomment-2096425760. After merging #90 we want to modify @leelisae's code to add the following features:

jcohenadad commented 6 months ago

@leelisae I'm using the data you sent me on 2024-05-15, but I neither see the PSIR image, nor the lesion segmentation. See for example the files for one subject:

julien-macbook:~/Desktop/canproco/data/CAN-01-RRM-133-M0 $ tree
.
├── mt
│   ├── mt0.nii.gz
│   ├── mt1.nii.gz
│   └── mt_t1.nii.gz
└── t2
    └── t2.nii.gz

Wasn't the plan that you run @plbenveniste's model to get the lesion segmentation as per our discussion https://github.com/ivadomed/canproco/issues/88? Once you do it, you can send me the data that include the lesion segmentation, so I can work on the registration and metric extraction code. Given that the lesion masks are derivatives, I suggest you add them in your dataset as an extra folder 'derivatives'.

leelisae commented 6 months ago

@jcohenadad - I understood that once we confirmed that there were no issues with the BIDS ID numbers within each site (#88), I can use the lesion masks that your team has already generated instead of having to redo the processing again. If I’m correct in my understanding, I have received the lesion masks and I’ve added both the lesion mask and the PSIR image to the data folder in our shared Dropbox.

I’m not sure if I understood the part re: “derivatives” folder. I added this folder as I understood, but if I’m misunderstood, please feel free to relocate it appropriately, and I will follow your instructions when analyzing non-lesional MTR of the SC using the lesion masks generated from the PSIR sequence for the rest of the subjects later.

I also found it interesting that lesion masks were generated for healthy controls, as shown in the example in Dropbox. Do you believe that the lesion masks are accurate for healthy controls, or would it be more reasonable to process non-lesional MTR in the SC for patients only?

Thank you for all your help! I'm excited to learn which command lines are optimal to use for the features you listed above.

jcohenadad commented 6 months ago

Good, the example dataset version 2024-05-16_14h55min (@leelisae please always refer to the date/time of the dataset, to make sure we both refer to the same dataset when going back-and-forth with analysis debugging/interpretation) seems to have the PSIR and lesion masks:

.
├── CAN-01-CON-039-M0
│   ├── mt
│   │   ├── mt0.nii.gz
│   │   ├── mt1.nii.gz
│   │   └── mt_t1.nii.gz
│   ├── psir
│   │   └── psir.nii.gz
│   └── t2
│       └── t2.nii.gz
├── CAN-01-RRM-133-M0
│   ├── mt
│   │   ├── mt0.nii.gz
│   │   ├── mt1.nii.gz
│   │   └── mt_t1.nii.gz
│   ├── psir
│   │   └── psir.nii.gz
│   └── t2
│       └── t2.nii.gz
├── CAN-03-RRM-092-M0
│   ├── mt
│   │   ├── mt0.nii.gz
│   │   ├── mt1.nii.gz
│   │   └── mt_t1.nii.gz
│   ├── psir
│   │   └── psir.nii.gz
│   └── t2
│       └── t2.nii.gz
├── derivatives
│   └── lesion_masks
│       ├── CAN-01-CON-039-M0_lesion.nii.gz
│       ├── CAN-01-RRM-133-M0_lesion.nii.gz
│       └── CAN-03-RRM-092-M0_lesion.nii.gz
└── qc

I should be able to move forward with the analysis code.

I understood that once we confirmed that there were no issues with the BIDS ID numbers within each site (https://github.com/ivadomed/canproco/issues/88), I can use the lesion masks that your team has already generated instead of having to redo the processing again. If I’m correct in my understanding, I have received the lesion masks and I’ve added both the lesion mask and the PSIR image to the data folder in our shared Dropbox.

Yes, this is exactly it!

I’m not sure if I understood the part re: “derivatives” folder. I added this folder as I understood, but if I’m misunderstood, please feel free to relocate it appropriately, and I will follow your instructions when analyzing non-lesional MTR of the SC using the lesion masks generated from the PSIR sequence for the rest of the subjects later.

The derivatives folder is a BIDS requirement, and is a way to ensure reproducible pipeline (also see #92). The derivatives folder you produced does not completely follow BIDS convention, but since I understand you are pressed with time, this will be good enough for now.

I also found it interesting that lesion masks were generated for healthy controls, as shown in the example in Dropbox. Do you believe that the lesion masks are accurate for healthy controls, or would it be more reasonable to process non-lesional MTR in the SC for patients only?

That's an issue with the model, which is not perfect (no model is perfect). Tagging @plbenveniste

jcohenadad commented 6 months ago

Testing lisa/spine.sh version https://github.com/ivadomed/canproco/commit/8f7fbdbf5090e3d98c6202d2637523d0707061ee on data version 2024-05-16_14h55min, on subject CAN-01-RRM-133-M0, I encountered some errors:

Terminal output ```console julien-macbook:~/Desktop/canproco $ sh ~/code/canproco/lisa/spine.sh data/CAN-01-RRM-133-M0 qc data/CAN-01-RRM-133-M0: spine.sh started at 21/05/2024_03:03:53 pm -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_image -i t2.nii.gz -setorient RPI -o t2.nii.gz -- /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/t2.nii.gz Generate output files... File t2.nii.gz already exists. Will overwrite it. Done! To view results, type: fsleyes t2.nii.gz & -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_deepseg_sc -i t2.nii.gz -c t2 -qc qc -- Config deepseg_sc: Centerline algorithm: svm Brain in image: True Kernel dimension: 2d Contrast: t2 Threshold: 0.7 Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-03-58_deepseg-sc_mqqqikyl) Reorient the image to RPI, if necessary... Converting image from type 'int16' to type 'float64' for linear interpolation Finding the spinal cord centerline... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-01_optic-detect-centerline_sg6yc5va) Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-01_optic-detect-centerline_sg6yc5va Cropping the image around the spinal cord... Normalizing the intensity... Segmenting the spinal cord using deep learning on 2D patches... Reassembling the image... Resampling the segmentation to the native image resolution using linear interpolation... Binarizing the resampled segmentation... Removing small objects above slice #223 Image header specifies datatype 'float32', but array is of type 'uint8'. Header metadata will be overwritten to use 'uint8'. Converting image from type 'uint8' to type 'float64' for linear interpolation Compute shape analysis: 100%|██████████████| 224/224 [00:00<00:00, 252.16iter/s] Found isolated voxels on slice 0, Removing them Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-03-58_deepseg-sc_mqqqikyl *** Generate Quality Control (QC) html report *** Resampling image "t2.nii.gz" to 0.6x0.6 mm Converting image from type 'int16' to type 'float64' for spline interpolation Resampling image "t2_seg.nii.gz" to 0.6x0.6 mm Converting image from type 'uint8' to type 'float64' for linear interpolation Image header specifies datatype 'float64', but array is of type 'int64'. Header metadata will be overwritten to use 'int64'. QcImage: layout with Axial slice Compute center of mass at each slice /Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/scipy/ndimage/_measurements.py:1542: RuntimeWarning: invalid value encountered in scalar divide results = [sum(input * grids[dir].astype(float), labels, index) / normalizer /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/data/CAN-01-RRM-133-M0/t2/sct_deepseg_sc/2024_05_21_150423.083541/background_img.png cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/css/bootstrap.min.css /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/css cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/css/bootstrap-table.min.css /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/css cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/css/bootstrap.min.css.map /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/css cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/css/style.css /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/css cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/js/filesaver.min.js /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/js cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/js/jquery-3.1.0.min.js /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/js cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/js/bootstrap-table.min.js /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/js cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/js/main.js /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/js cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/js/bootstrap.min.js /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/js cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/js/yaml.min.js /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/js cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/imgs/f-icon.png /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/imgs cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/imgs/keyright.png /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/imgs cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/imgs/keydown.png /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/imgs cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/imgs/keyup.png /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/imgs cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/imgs/sct_logo.png /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/imgs cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/fonts/glyphicons-halflings-regular.woff /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/fonts cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/fonts/glyphicons-halflings-regular.eot /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/fonts cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/fonts/glyphicons-halflings-regular.woff2 /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/fonts cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/fonts/glyphicons-halflings-regular.ttf /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/fonts cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/fonts/glyphicons-halflings-regular.svg /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/fonts cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/html/index.html /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/html cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/py/__init__.py /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/py cp /Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/reports/assets/_assets/py/refresh_qc_entries.py /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_assets/py Successfully generated the QC results in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_json/qc_2024_05_21_150423.083541.json To see the results in a browser, type: open /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/index.html Done! To view results, type: fsleyes t2.nii.gz -cm greyscale t2_seg.nii.gz -cm red -a 70.0 & -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc qc -- Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz) Copying input data to tmp folder... Straighten spinal cord... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_straighten-spinalcord_4iphg1of) Copy files to tmp folder... Fitting centerline using B-spline approximation Error on approximation = 2.13 mm Error on approximation = 0.34 mm Error on approximation = 0.4 mm Error on approximation = 0.24 mm Error on approximation = 0.15 mm Error on approximation = 0.16 mm Error on approximation = 0.14 mm Error on approximation = 0.13 mm Error on approximation = 0.12 mm Error on approximation = 0.11 mm Error on approximation = 0.1 mm Error on approximation = 0.1 mm Create the straight space and the safe zone Length of spinal cord: 183.93273777310836 Size of spinal cord in z direction: 175.7116825840148 Ratio length/size: 1.046787186077754 Safe zone boundaries (curved space): [-248.41161818807487, -72.69993560406007] Safe zone boundaries (straight space): [-252.52214578262164, -68.58940800951329] Pad input volume to account for spinal cord length... Time to generate centerline: 17.0 ms 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 228/228 [00:03<00:00, 59.96it/s] 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 336/336 [00:21<00:00, 15.62it/s] Image header specifies datatype 'float32', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'. Warping field generated: tmp.curve2straight.nii.gz Image header specifies datatype 'float32', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'. Warping field generated: tmp.straight2curve.nii.gz Apply transformation to input image... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i data.nii -o tmp.anat_rigid_warp.nii.gz -t tmp.curve2straight.nii.gz -r tmp.centerline_pad_crop.nii.gz -n 'BSpline[3]' # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_straighten-spinalcord_4iphg1of Generate output files... mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_straighten-spinalcord_4iphg1of/tmp.curve2straight.nii.gz ./warp_curve2straight.nii.gz File created: ./warp_curve2straight.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_straighten-spinalcord_4iphg1of/tmp.straight2curve.nii.gz ./warp_straight2curve.nii.gz File created: ./warp_straight2curve.nii.gz cp /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_straighten-spinalcord_4iphg1of/tmp.anat_rigid_warp.nii.gz ./straight_ref.nii.gz File created: ./data_straight.nii Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_straighten-spinalcord_4iphg1of Resample to 0.5mm isotropic... load data... Apply straightening to segmentation... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i segmentation.nii -o segmentation_straight.nii -t warp_curve2straight.nii.gz -r data_straightr.nii -n Linear # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz File /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/segmentation_straight.nii already exists. Will overwrite it. Create label to identify disc... Creating temporary folder... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-04_detect-c2c3_l0u8obag) Run C2-C3 detector... C2-C3 detected... Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-04_detect-c2c3_l0u8obag File /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/labelz.nii.gz already exists. Will overwrite it. And apply straightening to label... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i labelz.nii.gz -o labelz_straight.nii.gz -t warp_curve2straight.nii.gz -r data_straightr.nii -n NearestNeighbor # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz Get z and disc values from straight label... .. [300, 3] Look for template... Path template: /Users/julien/code/spinalcordtoolbox/data/PAM50 Open template and vertebral levels... Disc values from template: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] Z-values for each disc: [984, 938, 907, 870, 833, 800, 769, 735, 692, 646, 600, 551, 500, 449, 396, 342, 289, 231, 168, 105, 39] Distances between discs (in voxel): [46.0, 31.0, 37.0, 37.0, 33.0, 31.0, 34.0, 43.0, 46.0, 46.0, 49.0, 51.0, 51.0, 53.0, 54.0, 53.0, 58.0, 63.0, 63.0, 66.0] Detect intervertebral discs... Current disc: 2 (z=300). Direction: superior .. Peak found: z=-4 (correlation = 0.38128107973592007) Current disc: 1 (z=327). Direction: superior .. correcting factor: 1.0 .. Switching to inferior direction. Current disc: 3 (z=263). Direction: inferior .. Peak found: z=1 (correlation = 0.4843182741664749) .. correcting factor: 0.9324324324324325 Current disc: 4 (z=230). Direction: inferior .. Peak found: z=-4 (correlation = 0.4828105797896957) .. correcting factor: 0.963963963963964 Current disc: 5 (z=194). Direction: inferior .. Peak found: z=-1 (correlation = 0.4628382734736265) .. correcting factor: 0.972972972972973 Current disc: 6 (z=163). Direction: inferior .. Peak found: z=-3 (correlation = 0.517582305620323) .. correcting factor: 0.99128160418483 Current disc: 7 (z=126). Direction: inferior .. Peak found: z=3 (correlation = 0.47165516401294705) .. correcting factor: 0.9780287878010839 Current disc: 8 (z=87). Direction: inferior .. Peak found: z=1 (correlation = 0.3974775151997078) .. correcting factor: 0.9745230141285038 Current disc: 9 (z=43). Direction: inferior .. Peak found: z=5 (correlation = 0.3856986960305723) .. correcting factor: 0.9614032895363538 Current disc: 10 (z=4). Direction: inferior .. Peak found: z=9 (correlation = 0.39838124385098395) .. correcting factor: 0.9391217646120246 Adding top disc based on adjusted template distance: #0 .. approximate distance: 43 Un-straighten labeling... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i segmentation_straight_labeled.nii -o segmentation_labeled.nii -t warp_straight2curve.nii.gz -r segmentation.nii -n NearestNeighbor # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz Cleaning labeled segmentation: removing labeled voxels outside segmentation... Done cleaning. File /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/segmentation_labeled.nii already exists. Will overwrite it. Label discs... Un-straighten labeled discs... Dilate labels before warping... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-12_apply-transfo-3d-label_6ue49hjl) /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-12_apply-transfo-3d-label_6ue49hjl/dilated_data.nii -o segmentation_labeled_disc.nii -t warp_straight2curve.nii.gz -r segmentation.nii -n NearestNeighbor # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz Take the center of mass of each registered dilated labels... File segmentation_labeled_disc.nii already exists. Will overwrite it. Generate output files... File created: /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/t2_seg_labeled.nii.gz File created: /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/t2_seg_labeled_discs.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/straightening.cache /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/straightening.cache File created: /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/straightening.cache mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/warp_curve2straight.nii.gz /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/warp_curve2straight.nii.gz File created: /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/warp_curve2straight.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/warp_straight2curve.nii.gz /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/warp_straight2curve.nii.gz File created: /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/warp_straight2curve.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz/straight_ref.nii.gz /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/straight_ref.nii.gz File created: /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/straight_ref.nii.gz Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-04-26_label-vertebrae_6b323rzz *** Generate Quality Control (QC) html report *** QcImage: layout with Sagittal slice /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/data/CAN-01-RRM-133-M0/t2/sct_label_vertebrae/2024_05_21_150517.308802/background_img.png Successfully generated the QC results in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_json/qc_2024_05_21_150517.308802.json To see the results in a browser, type: open /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/index.html Done! To view results, type: fsleyes t2.nii.gz -cm greyscale -a 100.0 t2_seg_labeled.nii.gz -cm subcortical -a 50.0 & -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_label_utils -i t2_seg_labeled.nii.gz -vert-body 3,5 -o t2_labels_vert.nii.gz -- Generating output files... Done! To view results, type: fsleyes t2_seg_labeled.nii.gz t2_labels_vert.nii.gz & -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_qc -i t2.nii.gz -s t2_labels_vert.nii.gz -p sct_label_utils -qc qc -- *** Generate Quality Control (QC) html report *** QcImage: layout with Sagittal slice qc/data/CAN-01-RRM-133-M0/t2/sct_label_utils/2024_05_21_150521.312335/background_img.png Successfully generated the QC results in qc/_json/qc_2024_05_21_150521.312335.json To see the results in a browser, type: open qc/index.html -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -l t2_labels_vert.nii.gz -c t2 -qc qc -- Check template files... OK: /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t2.nii.gz OK: /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_levels.nii.gz OK: /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_cord.nii.gz Check parameters: Data: t2.nii.gz Landmarks: t2_labels_vert.nii.gz Segmentation: t2_seg.nii.gz Path template: /Users/julien/code/spinalcordtoolbox/data/PAM50 Remove temp files: 1 Check input labels... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox) Copying input data to tmp folder and convert to nii... Generate labels from template vertebral labeling Check if provided labels are available in the template Binarize segmentation Change orientation of input images to RPI... Resample data to 1mm isotropic... load data... Converting image from type 'int16' to type 'float64' for linear interpolation Done! To view results, type: fsleyes data_rpi_1mm.nii & load data... Converting image from type 'uint8' to type 'float64' for linear interpolation Done! To view results, type: fsleyes seg_bin_rpi_1mm.nii.gz & To avoid intensity overflow due to convertion to +uint8+, intensity will be rescaled to the maximum quantization scale Straighten the spinal cord using centerline/segmentation... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y) Copy files to tmp folder... File /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y/centerline_rpi.nii.gz already exists. Will overwrite it. Create the straight space and the safe zone Length of spinal cord: 184.4883691140574 Size of spinal cord in z direction: 176.1772127122498 Ratio length/size: 1.047174979521229 Safe zone boundaries (curved space): [-248.45713558582204, -72.27992287357225] Safe zone boundaries (straight space): [-252.61271378672586, -68.12434467266844] Pad input volume to account for spinal cord length... Time to generate centerline: 16.0 ms 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 184/184 [00:03<00:00, 49.20it/s] 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 194/194 [00:07<00:00, 25.30it/s] Image header specifies datatype 'float32', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'. Warping field generated: tmp.curve2straight.nii.gz Image header specifies datatype 'float32', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'. Warping field generated: tmp.straight2curve.nii.gz Apply transformation to input image... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i data.nii -o tmp.anat_rigid_warp.nii.gz -t tmp.curve2straight.nii.gz -r tmp.centerline_pad_crop.nii.gz -n 'BSpline[3]' # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y Generate output files... mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y/tmp.curve2straight.nii.gz ./warp_curve2straight.nii.gz File created: ./warp_curve2straight.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y/tmp.straight2curve.nii.gz ./warp_straight2curve.nii.gz File created: ./warp_straight2curve.nii.gz cp /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y/tmp.anat_rigid_warp.nii.gz ./straight_ref.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y/tmp.anat_rigid_warp.nii.gz /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/seg_bin_rpi_1mm_crop_straight.nii.gz File created: /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/seg_bin_rpi_1mm_crop_straight.nii.gz Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-31_straighten-spinalcord_27lpij7y /Users/julien/code/spinalcordtoolbox/bin/isct_ComposeMultiTransform 3 warp_straight2curve.nii.gz -R /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/data_rpi_1mm.nii warp_straight2curve.nii.gz # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Remove unused label on template. Keep only label present in the input label image... File template_label_body.nii.gz already exists. Will overwrite it. Dilating input labels using 3vox ball radius Apply straightening to labels... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/label_projected_rpi_1mm_dilate.nii.gz -o /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/label_projected_rpi_1mm_dilate_straight.nii.gz -t warp_curve2straight.nii.gz -r /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/seg_bin_rpi_1mm_crop_straight.nii.gz -n NearestNeighbor # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Estimate transformation for step #0... Labels src: [[-12.989009665255331, 21.020957333508886, -115.7399487443337], [-18.32404148351408, 20.708072310129904, -151.1567461340793]] Labels dest: [[-0.0, 45.720001220703125, -117.34002685546875], [-0.0, 45.720001220703125, -153.34002685546875]] Degrees of freedom (dof): Tx_Ty_Tz_Sz Optimization terminated successfully. Current function value: 14.280231 Iterations: 2 Function evaluations: 186 Matrix: [[ 1. 0. 0.] [ 0. 1. 0.] [-0. 0. 1.]] Center: [ 0. 45.72000122 -135.34002686] Translation: [[-15.65652557 -24.85548639 1.89167943]] Concatenate transformations: curve --> straight --> affine... /Users/julien/code/spinalcordtoolbox/bin/isct_ComposeMultiTransform 3 warp_curve2straightAffine.nii.gz -R template.nii straight2templateAffine.txt warp_curve2straight.nii.gz # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Apply transformation... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/data_rpi_1mm.nii -o /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/data_rpi_1mm_straightAffine.nii -t warp_curve2straightAffine.nii.gz -r template.nii -n 'BSpline[3]' # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/seg_bin_rpi_1mm_crop.nii.gz -o /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/seg_bin_rpi_1mm_crop_straightAffine.nii.gz -t warp_curve2straightAffine.nii.gz -r template.nii -n Linear # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Image header specifies datatype 'float64', but array is of type ''. Header metadata will be overwritten to use ''. Crop data in template space (for faster processing)... Sub-sample in z-direction (for faster processing)... load data... Converting image from type 'uint16' to type 'float64' for linear interpolation load data... Converting image from type 'uint8' to type 'float64' for linear interpolation load data... load data... Register straight spinal cord to template... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg) Copying input data to tmp folder and convert to nii... -- ESTIMATE TRANSFORMATION FOR STEP #1 Registration parameters: type ........... imseg algo ........... centermassrot slicewise ...... 0 metric ......... MeanSquares samplStrategy .. None samplPercent ... 0.2 iter ........... 10 smooth ......... 0 laplacian ...... 0 shrink ......... 1 gradStep ....... 0.5 deformation .... 1x1x0 init ........... poly ........... 5 filter_size .... 5 dof ............ Tx_Ty_Tz_Rx_Ry_Rz smoothWarpXY ... 2 rot_method ..... pcahog Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-10_register-slicewise__qc1qbf_) Copy input data to temp folder... Get image dimensions of destination image... matrix size: 141 x 141 x 92 voxel size: 0.5mm x 0.5mm x 92mm Split input segmentation... Split destination segmentation... Split input image... Split destination image... Estimate cord angle for each slice: 0%| | 0/92 [00:00 step1Warp.nii.gz Generate warping field... Image header specifies datatype 'float32', but array is of type 'float64'. Header metadata will be overwritten to use 'float64'. --> step1InverseWarp.nii.gz Move warping fields... cp step1Warp.nii.gz /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg cp step1InverseWarp.nii.gz /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-10_register-slicewise__qc1qbf_ -- ESTIMATE TRANSFORMATION FOR STEP #2 Apply transformation from previous step /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i src_seg.nii -o src_seg_reg.nii -t warp_forward_1.nii.gz -r dest_seg_RPI.nii -n NearestNeighbor # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg Registration parameters: type ........... seg algo ........... bsplinesyn slicewise ...... 0 metric ......... MeanSquares samplStrategy .. None samplPercent ... 0.2 iter ........... 3 smooth ......... 1 laplacian ...... 0 shrink ......... 1 gradStep ....... 0.5 deformation .... 1x1x0 init ........... poly ........... 5 filter_size .... 5 dof ............ Tx_Ty_Tz_Rx_Ry_Rz smoothWarpXY ... 2 rot_method ..... pca Estimate transformation /Users/julien/code/spinalcordtoolbox/bin/isct_antsRegistration --dimensionality 3 --transform 'bsplinesyn[0.5,1,3]' --metric 'MeanSquares[dest_seg_RPI_pad.nii,src_seg_reg.nii,1,4]' --convergence 3 --shrink-factors 1 --smoothing-sigmas 1mm --restrict-deformation 1x1x0 --output '[step2,src_seg_reg_regStep2.nii]' --interpolation 'BSpline[3]' --verbose 1 # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg Concatenate transformations... /Users/julien/code/spinalcordtoolbox/bin/isct_ComposeMultiTransform 3 warp_src2dest.nii.gz -R dest.nii warp_forward_2.nii.gz warp_forward_1.nii.gz # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg /Users/julien/code/spinalcordtoolbox/bin/isct_ComposeMultiTransform 3 warp_dest2src.nii.gz -R src.nii warp_inverse_1.nii.gz warp_inverse_2.nii.gz # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg Apply transfo source --> dest... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i src.nii -o src_reg.nii -t warp_src2dest.nii.gz -r dest.nii -n Linear # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg Apply transfo dest --> source... /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i dest.nii -o dest_reg.nii -t warp_dest2src.nii.gz -r src.nii -n Linear # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg Generate output files... mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg/src_reg.nii data_rpi_1mm_straightAffine_crop_sub_reg.nii File created: data_rpi_1mm_straightAffine_crop_sub_reg.nii mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg/warp_src2dest.nii.gz warp_data_rpi_1mm_straightAffine_crop_sub2template_crop_sub.nii.gz File created: warp_data_rpi_1mm_straightAffine_crop_sub2template_crop_sub.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg/dest_reg.nii template_crop_sub_reg.nii File created: template_crop_sub_reg.nii mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg/warp_dest2src.nii.gz warp_template_crop_sub2data_rpi_1mm_straightAffine_crop_sub.nii.gz File created: warp_template_crop_sub2data_rpi_1mm_straightAffine_crop_sub.nii.gz Remove temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-06-09_register-wrapper_1uwvzwfg Concatenate transformations: anat --> template... /Users/julien/code/spinalcordtoolbox/bin/isct_ComposeMultiTransform 3 warp_anat2template.nii.gz -R template.nii warp_data_rpi_1mm_straightAffine_crop_sub2template_crop_sub.nii.gz warp_curve2straightAffine.nii.gz # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Concatenate transformations: template --> anat... /Users/julien/code/spinalcordtoolbox/bin/isct_ComposeMultiTransform 3 warp_template2anat.nii.gz -R data.nii warp_straight2curve.nii.gz -i straight2templateAffine.txt warp_template_crop_sub2data_rpi_1mm_straightAffine_crop_sub.nii.gz # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i template.nii -o template2anat.nii.gz -t warp_template2anat.nii.gz -r data.nii -n 'BSpline[3]' # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i data.nii -o anat2template.nii.gz -t warp_anat2template.nii.gz -r template.nii -n 'BSpline[3]' # in /private/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Generate output files... mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/warp_template2anat.nii.gz warp_template2anat.nii.gz File created: warp_template2anat.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/warp_anat2template.nii.gz warp_anat2template.nii.gz File created: warp_anat2template.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/template2anat.nii.gz template2anat.nii.gz File created: template2anat.nii.gz mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/anat2template.nii.gz anat2template.nii.gz File created: anat2template.nii.gz File straightening.cache already exists. Deleting it.. mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/straightening.cache straightening.cache File created: straightening.cache File warp_curve2straight.nii.gz already exists. Deleting it.. mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/warp_curve2straight.nii.gz warp_curve2straight.nii.gz File created: warp_curve2straight.nii.gz File warp_straight2curve.nii.gz already exists. Deleting it.. mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/warp_straight2curve.nii.gz warp_straight2curve.nii.gz File created: warp_straight2curve.nii.gz File straight_ref.nii.gz already exists. Deleting it.. mv /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox/straight_ref.nii.gz straight_ref.nii.gz File created: straight_ref.nii.gz Delete temporary files... rm -rf /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-05-25_register-to-template_iqlil2ox Finished! Elapsed time: 118s *** Generate Quality Control (QC) html report *** Resampling image "t2.nii.gz" to 0.6x0.6 mm Converting image from type 'int16' to type 'float64' for spline interpolation Resampling image "template2anat.nii.gz" to 0.6x0.6 mm Resampling image "t2_seg.nii.gz" to 0.6x0.6 mm Converting image from type 'uint8' to type 'float64' for linear interpolation Image header specifies datatype 'float64', but array is of type 'int64'. Header metadata will be overwritten to use 'int64'. QcImage: layout with Axial slice Compute center of mass at each slice /Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/scipy/ndimage/_measurements.py:1542: RuntimeWarning: invalid value encountered in scalar divide results = [sum(input * grids[dir].astype(float), labels, index) / normalizer /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/data/CAN-01-RRM-133-M0/t2/sct_register_to_template/2024_05_21_150729.684801/background_img.png Successfully generated the QC results in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_json/qc_2024_05_21_150729.684801.json To see the results in a browser, type: open /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/index.html Done! To view results, type: fsleyes t2.nii.gz template2anat.nii.gz & Done! To view results, type: fsleyes /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t2.nii.gz anat2template.nii.gz & -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_warp_template -d t2.nii.gz -w warp_template2anat.nii.gz -a 0 -qc qc -- Check parameters: Working directory ........ /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Destination image ........ t2.nii.gz Warping field ............ warp_template2anat.nii.gz Path template ............ /Users/julien/code/spinalcordtoolbox/data/PAM50 Output folder ............ label WARP TEMPLATE: /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t1.nii.gz -o label/template/PAM50_t1.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t2.nii.gz -o label/template/PAM50_t2.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t2s.nii.gz -o label/template/PAM50_t2s.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_cord.nii.gz -o label/template/PAM50_cord.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_wm.nii.gz -o label/template/PAM50_wm.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_gm.nii.gz -o label/template/PAM50_gm.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_csf.nii.gz -o label/template/PAM50_csf.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_levels.nii.gz -o label/template/PAM50_levels.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_levels_continuous.nii.gz -o label/template/PAM50_levels_continuous.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Dilate labels before warping... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-07-54_apply-transfo-3d-label_i6hptd97) /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-07-54_apply-transfo-3d-label_i6hptd97/dilated_data.nii -o label/template/PAM50_label_body.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Take the center of mass of each registered dilated labels... File label/template/PAM50_label_body.nii.gz already exists. Will overwrite it. Dilate labels before warping... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-08-05_apply-transfo-3d-label_rc4iqr2l) /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-08-05_apply-transfo-3d-label_rc4iqr2l/dilated_data.nii -o label/template/PAM50_label_disc.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Take the center of mass of each registered dilated labels... File label/template/PAM50_label_disc.nii.gz already exists. Will overwrite it. Dilate labels before warping... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-08-17_apply-transfo-3d-label_34m6xw19) /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-08-17_apply-transfo-3d-label_34m6xw19/dilated_data.nii -o label/template/PAM50_label_discPosterior.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Take the center of mass of each registered dilated labels... File label/template/PAM50_label_discPosterior.nii.gz already exists. Will overwrite it. /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_spine.nii.gz -o label/template/PAM50_spine.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_centerline.nii.gz -o label/template/PAM50_centerline.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n Linear # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Dilate labels before warping... Creating temporary folder (/var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-08-31_apply-transfo-3d-label_6zj3ln9l) /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /var/folders/5f/6n99hhyj5_g5cv_1bbx1q7cr0000gn/T/sct_2024-05-21_15-08-31_apply-transfo-3d-label_6zj3ln9l/dilated_data.nii -o label/template/PAM50_spinal_midpoint.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Take the center of mass of each registered dilated labels... File label/template/PAM50_spinal_midpoint.nii.gz already exists. Will overwrite it. /Users/julien/code/spinalcordtoolbox/bin/isct_antsApplyTransforms -d 3 -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_spinal_levels.nii.gz -o label/template/PAM50_spinal_levels.nii.gz -t warp_template2anat.nii.gz -r t2.nii.gz -n NearestNeighbor # in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 cp /Users/julien/code/spinalcordtoolbox/data/PAM50/template/info_label.txt label/template *** Generate Quality Control (QC) html report *** Resampling image "t2.nii.gz" to 0.6x0.6 mm Converting image from type 'int16' to type 'float64' for spline interpolation Resampling image "PAM50_wm.nii.gz" to 0.6x0.6 mm QcImage: layout with Axial slice Compute center of mass at each slice /Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/scipy/ndimage/_measurements.py:1542: RuntimeWarning: invalid value encountered in scalar divide results = [sum(input * grids[dir].astype(float), labels, index) / normalizer /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/data/CAN-01-RRM-133-M0/t2/sct_warp_template/2024_05_21_150848.230939/background_img.png Successfully generated the QC results in /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/_json/qc_2024_05_21_150848.230939.json To see the results in a browser, type: open /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/qc/index.html Done! To view results, type: fsleyes t2.nii.gz -cm greyscale -a 100.0 label/template/PAM50_t2.nii.gz -cm greyscale -dr 0 4000 -a 100.0 label/template/PAM50_gm.nii.gz -cm red-yellow -dr 0.4 1 -a 50.0 label/template/PAM50_wm.nii.gz -cm blue-lightblue -dr 0.4 1 -a 50.0 & -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_process_segmentation -i t2_seg.nii.gz -vert 2:4 -vertfile ./label/template/PAM50_levels.nii.gz -o csa_c2c4.csv -append 0 -- Converting image from type 'uint8' to type 'float64' for linear interpolation Compute shape analysis: 100%|██████████████| 223/223 [00:00<00:00, 260.66iter/s] Aggregating metrics: 100%|██████████████████████| 9/9 [00:02<00:00, 3.15iter/s] Done! To view results, type: open /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/csa_c2c4.csv /Users/julien/code/canproco/lisa/spine.sh: line 54: cd: data/CAN-01-RRM-133-M0/mt: No such file or directory -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_image -i mt_t1.nii.gz -setorient RPI -o mt_t1.nii.gz -- Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_image.py", line 655, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_image.py", line 257, in main im_in_list = [Image(fname) for fname in fname_in] File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_image.py", line 257, in im_in_list = [Image(fname) for fname in fname_in] File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_deepseg_sc -i mt_t1.nii.gz -c t1 -qc qc -- Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_deepseg_sc.py", line 211, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_deepseg_sc.py", line 182, in main check_dim(fname_image, dim_lst=[2, 3]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 1460, in check_dim dim = Image(fname).hdr['dim'][:4] File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_create_mask -i mt_t1.nii.gz -p centerline,mt_t1_seg.nii.gz -size 35mm -f cylinder -o mt_t1_mask.nii.gz -- ERROR: The file mt_t1_seg.nii.gz does not exist. Exit program. -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_register_multimodal -i /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t1.nii.gz -iseg /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_cord.nii.gz -d mt_t1.nii.gz -dseg mt_t1_seg.nii.gz -m mt_t1_mask.nii.gz -param step=1,type=seg,algo=slicereg,metric=MeanSquares,smooth=2:step=2,type=im,algo=syn,metric=CC,iter=5,gradStep=0.5 -initwarp data/CAN-01-RRM-133-M0/t2/warp_template2anat.nii.gz -initwarpinv data/CAN-01-RRM-133-M0/t2/warp_anat2template.nii.gz -owarp warp_template2mt.nii.gz -qc qc -- Input parameters: Source .............. /Users/julien/code/spinalcordtoolbox/data/PAM50/template/PAM50_t1.nii.gz (141, 141, 991) Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_register_multimodal.py", line 443, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_register_multimodal.py", line 376, in main printv(f' Destination ......... {fname_dest} {Image(fname_dest).data.shape}') File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_warp_template -d mt_t1.nii.gz -w warp_template2mt.nii.gz -a 1 -qc qc -- Check parameters: Working directory ........ /Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2 Destination image ........ mt_t1.nii.gz Warping field ............ warp_template2mt.nii.gz Path template ............ /Users/julien/code/spinalcordtoolbox/data/PAM50 Output folder ............ label WARP TEMPLATE: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/warp_template2mt.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_warp_template.py", line 310, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_warp_template.py", line 274, in main w = WarpTemplate(fname_src, fname_transfo, warp_atlas, folder_out, path_template, File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_warp_template.py", line 71, in __init__ warp_label(self.path_template, self.folder_template, self.file_info_label, self.fname_src, File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_warp_template.py", line 115, in warp_label sct_apply_transfo.main(['-i', fname_label, File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_apply_transfo.py", line 345, in main transform.apply() File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_apply_transfo.py", line 159, in apply and Image(list_warp[idx_warp]).header.get_intent()[0] != 'vector': File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/warp_template2mt.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_register_multimodal -i mt0.nii.gz -d mt_t1.nii.gz -dseg mt_t1_seg.nii.gz -m mt_t1_mask.nii.gz -param step=1,type=im,algo=slicereg,metric=CC -x spline -o mt0_reg.nii.gz -qc qc -- Input parameters: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt0.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_register_multimodal.py", line 443, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_register_multimodal.py", line 375, in main printv(f' Source .............. {fname_src} {Image(fname_src).data.shape}') File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt0.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_register_multimodal -i mt1.nii.gz -d mt_t1.nii.gz -dseg mt_t1_seg.nii.gz -m mt_t1_mask.nii.gz -param step=1,type=im,algo=slicereg,metric=CC -x spline -o mt1_reg.nii.gz -qc qc -- Input parameters: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt1.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_register_multimodal.py", line 443, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_register_multimodal.py", line 375, in main printv(f' Source .............. {fname_src} {Image(fname_src).data.shape}') File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt1.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_compute_mtr -mt0 mt0_reg.nii.gz -mt1 mt1_reg.nii.gz -- Compute MTR... Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 100, in load stat_result = os.stat(filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt1_reg.nii.gz' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_compute_mtr.py", line 89, in main(sys.argv[1:]) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_compute_mtr.py", line 79, in main nii_mtr = compute_mtr(nii_mt1=Image(arguments.mt1), nii_mt0=Image(arguments.mt0), threshold_mtr=arguments.thr) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 285, in __init__ raise e File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 280, in __init__ self.loadFromPath(param, mmap, verbose) File "/Users/julien/code/spinalcordtoolbox/spinalcordtoolbox/image.py", line 428, in loadFromPath im_file = nib.load(self.absolutepath, mmap=mmap) File "/Users/julien/code/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/nibabel/loadsave.py", line 102, in load raise FileNotFoundError(f"No such file or no access: '{filename}'") FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt1_reg.nii.gz' -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 50 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:18 -o csv/mtr_cord.csv -append 0 -- ERROR: mtr.nii.gz does not exist. Exit program. -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 52 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:18 -o csv/mtr_gm.csv -append 0 -- ERROR: mtr.nii.gz does not exist. Exit program. -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 51 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:18 -o csv/mtr_wm.csv -append 0 -- ERROR: mtr.nii.gz does not exist. Exit program. -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 53 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:18 -o csv/mtr_dc.csv -append 0 -- ERROR: mtr.nii.gz does not exist. Exit program. -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 54 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:18 -o csv/mtr_lf.csv -append 0 -- ERROR: mtr.nii.gz does not exist. Exit program. -- Spinal Cord Toolbox (git-master-e5525085b7d8531416a7fee304d8a71714d540ba) sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 55 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:18 -o csv/mtr_vf.csv -append 0 -- ERROR: mtr.nii.gz does not exist. Exit program. data/CAN-01-RRM-133-M0: spine.sh finished at 21/05/2024_03:09:20 pm data/CAN-01-RRM-133-M0: spine.sh duration: 327 seconds ```

The first error is:

FileNotFoundError: No such file or no access: '/Users/julien/Desktop/canproco/data/CAN-01-RRM-133-M0/t2/mt_t1.nii.gz'

Apparently the code is expecting a file t2/mt_t1.nii.gz, but this file is under mt/ and not under t2/. @leelisae it seems that either the data or the code you sent me is faulty. Please send me a working version, so I can start implementing the requested feature.

lisaeylee commented 6 months ago

@jcohenadad - This is strange. I tested lisa/spine.sh using SCT 5.7 on data version 2024-05-16_14h55min, on subject CAN-01-RRM-133-M0 and CAN-03-RRM-092-M0, and did not encounter any errors and generated all expected QCs too.

There is a line cd ${SUBJECT}/mt prior to performing sct_image -i mt_t1.nii.gz -setorient RPI -o mt_t1.nii.gz; so the code should know to change to the correct directory mt/ for mt/mt_t1.nii.gz. I will add a ";" at the end of cd ${SUBJECT}/mt but I don't think this is the issue as I was able to run the script without this.

Terminal Saved Output.pdf

jcohenadad commented 6 months ago

Cause of the issue reported in https://github.com/ivadomed/canproco/issues/91#issuecomment-2123346566 is now explained in https://github.com/ivadomed/canproco/issues/93

After fixing https://github.com/ivadomed/canproco/issues/93 the script is running properly! I was able to fully process a subject 😊.