Hello,
I am attempting to use sct_crop_image to crop a 4D image, but whether I pass the mask or use -xmax/-xmin/etc. to manually define the bounds, I get the following error. This command works reliably on other datasets. Do you have any insight into how to fix this? Happy to provide the dataset by some secure method if necessary.
Thanks,
-Alan
Spinal Cord Toolbox (5.4)
sct_crop_image -i fmri_ss75/im.nii.gz -m fmri_ss75/im_mean_mask.nii.gz -o fmri_ss75/im_crop.nii.gz -v 2
--
Loaded fmri_ss75/im.nii.gz (path redacted) orientation RPI shape (112, 112, 24, 400)
Loaded fmri_ss75/im_mean_mask.nii.gz (path redacted) orientation RPI shape (112, 112, 24)
Bounding box: x=[28, 80], y=[48, 100], z=[0, 24]
Cropping the image...
Traceback (most recent call last):
File "/usr/local/sct_v5.4.0/spinalcordtoolbox/scripts/sct_crop_image.py", line 180, in <module>
main(sys.argv[1:])
File "/usr/local/sct_v5.4.0/spinalcordtoolbox/scripts/sct_crop_image.py", line 166, in main
img_crop = cropper.crop(background=arguments.b)
File "/usr/local/sct_v5.4.0/spinalcordtoolbox/cropping.py", line 98, in crop
new_origin = np.dot(img_out.hdr.get_qform(), [bbox.xmin, bbox.ymin, bbox.zmin, 1])
File "/usr/local/sct_v5.4.0/python/envs/venv_sct/lib/python3.6/site-packages/nibabel/nifti1.py", line 915, in get_qform
quat = self.get_qform_quaternion()
File "/usr/local/sct_v5.4.0/python/envs/venv_sct/lib/python3.6/site-packages/nibabel/nifti1.py", line 890, in get_qform_quaternion
return fillpositive(bcd, self.quaternion_threshold)
File "/usr/local/sct_v5.4.0/python/envs/venv_sct/lib/python3.6/site-packages/nibabel/quaternions.py", line 99, in fillpositive
raise ValueError(f'w2 should be positive, but is {w2:e}')
ValueError: w2 should be positive, but is -4.664622e-07
Output of sct_check_dependencies is:
Spinal Cord Toolbox (5.4)
sct_check_dependencies
--
SCT info:
- version: 5.4
- path: /usr/local/sct_v5.4.0
OS: osx (Darwin-21.2.0-x86_64-i386-64bit)
CPU cores: Available: 16, Used by ITK functions: 16
RAM: Total: 65536MB, Used: 15915MB, Available: 49615MB
Check Python executable.............................[OK]
Using bundled python 3.6.13 |Anaconda, Inc.| (default, Feb 23 2021, 12:58:59)
[GCC Clang 10.0.0 ] at /usr/local/sct_v5.4.0/python/envs/venv_sct/bin/python
Check if data are installed.........................[OK]
Check if colored is installed.......................[OK] (1.4.2)
Check if dipy is installed..........................[OK] (1.4.1)
Check if futures is installed.......................[OK]
Check if h5py is installed..........................[OK] (2.10.0)
Check if Keras (2.1.5) is installed.................[OK] (2.1.5)
Check if ivadomed is installed......................[OK] (2.8.0)
Check if matplotlib is installed....................[OK] (3.3.4)
Check if nibabel is installed.......................[OK] (3.2.1)
Check if numpy is installed.........................[OK] (1.19.5)
Check if onnxruntime (1.4.0) is installed...........[OK] (1.4.0)
Check if pandas is installed........................[OK] (1.1.5)
Check if psutil is installed........................[OK] (5.8.0)
Check if pyqt5 (5.11.3) is installed................[OK] (5.11.3)
Check if pytest is installed........................[OK] (6.2.5)
Check if pytest-cov is installed....................[OK] (2.12.1)
Check if raven is installed.........................[OK]
Check if requests is installed......................[OK] (2.26.0)
Check if requirements-parser is installed...........[OK] (0.2.0)
Check if scipy is installed.........................[OK] (1.5.4)
Check if scikit-image is installed..................[OK] (0.17.2)
Check if scikit-learn is installed..................[OK] (0.24.2)
Check if tensorflow (1.5.0) is installed............[OK] (1.5.0)
Check if torch (1.5.0) is installed.................[OK] (1.5.0)
Check if torchvision (0.6.0) is installed...........[OK] (0.6.0)
Check if xlwt is installed..........................[OK] (1.3.0)
Check if tqdm is installed..........................[OK] (4.62.3)
Check if transforms3d is installed..................[OK] (0.3.1)
Check if urllib3 is installed.......................[OK] (1.26.7)
Check if pytest_console_scripts is installed........[OK]
Check if wquantiles is installed....................[OK] (0.4)
Check if spinalcordtoolbox is installed.............[OK]
Check ANTs compatibility with OS ...................[OK]
Check PropSeg compatibility with OS ................[OK]
Check if figure can be opened with matplotlib.......[OK] (Using GUI backend: 'MacOSX')
Check if figure can be opened with PyQt.............[OK]
Check FSLeyes version...............................[OK] (0.28.3+build0)