External Email - Use Caution
Hi,
Thank you in advance for your assistance, I am new to freesurfer. I am trying to use EasyReg to register an axial T1 post-contrast series and an axial high-resolution T2 series, so that I can propagate a tumor segmentation from the T1 to the T2. I am getting the error message copied below. One problem I see is that the SynthSeg segmentation is not accurate, see screenshot. I am running freesurfer version 7.4.1 on WSL 2/Ubuntu 22. I would appreciate any pointers you may have, thank you very much.
Krish
mri_easyreg --ref t1.nii --flo t2.nii --ref_seg t1_seg.nii --flo_seg t2_seg.nii --ref_reg t1_reg.nii --flo_reg t2_reg.nii --fwd_field fwd_field.nii --bak_field bak_field.nii --threads -1
2025-03-16 21:49:05.684219: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. 2025-03-16 21:49:05.687469: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2025-03-16 21:49:05.728495: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2025-03-16 21:49:05.729021: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2025-03-16 21:49:06.476538: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT using all available threads ( 12 ) Segmenting reference image Reading reference image Setting up segmentation net Inference / segmentation 1/1 [==============================] - 11s 11s/step Postprocessing Saving result Segmenting floating image Reading floating image Inference / segmentation 1/1 [==============================] - 19s 19s/step Postprocessing Saving result Linear registration Computing centroids and estimating affine transform Traceback (most recent call last): File "/usr/local/freesurfer/7.4.1/python/scripts/mri_easyreg", line 1809, in <module> main() File "/usr/local/freesurfer/7.4.1/python/scripts/mri_easyreg", line 180, in main Mref = getM(atlasCOG[:, ok > 0], refCOG[:, ok > 0]) File "/usr/local/freesurfer/7.4.1/python/scripts/mri_easyreg", line 1198, in getM x = np.matmul(np.linalg.inv(np.matmul(np.transpose(A), A)), np.matmul(np.transpose(A), b)) File "<__array_function__ internals>", line 180, in inv File "/usr/local/freesurfer/7.4.1/python/lib/python3.8/site-packages/numpy/linalg/linalg.py", line 552, in inv ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) File "/usr/local/freesurfer/7.4.1/python/lib/python3.8/site-packages/numpy/linalg/linalg.py", line 89, in _raise_linalgerror_singular raise LinAlgError("Singular matrix") numpy.linalg.LinAlgError: Singular matrix
[cid:546a1e09-0300-496f-9c0d-58eb45c8e243]
Dear Krish, Yeah that segmentation will certainly cause EasyReg to fail. Could it be a problem with the image header, maybe? If you are able to share the image, I could take a look. Cheers, /Eugenio
-- Juan Eugenio Iglesias http://www.jeiglesias.com
From: freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Suresh, Krish krsuresh@health.ucsd.edu Date: Monday, March 17, 2025 at 1:18 AM To: freesurfer@nmr.mgh.harvard.edu freesurfer@nmr.mgh.harvard.edu Subject: [Freesurfer] EasyReg/SynthSeg singular matrix error
External Email - Use Caution Hi,
Thank you in advance for your assistance, I am new to freesurfer. I am trying to use EasyReg to register an axial T1 post-contrast series and an axial high-resolution T2 series, so that I can propagate a tumor segmentation from the T1 to the T2. I am getting the error message copied below. One problem I see is that the SynthSeg segmentation is not accurate, see screenshot. I am running freesurfer version 7.4.1 on WSL 2/Ubuntu 22. I would appreciate any pointers you may have, thank you very much.
Krish
mri_easyreg --ref t1.nii --flo t2.nii --ref_seg t1_seg.nii --flo_seg t2_seg.nii --ref_reg t1_reg.nii --flo_reg t2_reg.nii --fwd_field fwd_field.nii --bak_field bak_field.nii --threads -1
2025-03-16 21:49:05.684219: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. 2025-03-16 21:49:05.687469: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2025-03-16 21:49:05.728495: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2025-03-16 21:49:05.729021: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2025-03-16 21:49:06.476538: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT using all available threads ( 12 ) Segmenting reference image Reading reference image Setting up segmentation net Inference / segmentation 1/1 [==============================] - 11s 11s/step Postprocessing Saving result Segmenting floating image Reading floating image Inference / segmentation 1/1 [==============================] - 19s 19s/step Postprocessing Saving result Linear registration Computing centroids and estimating affine transform Traceback (most recent call last): File "/usr/local/freesurfer/7.4.1/python/scripts/mri_easyreg", line 1809, in <module> main() File "/usr/local/freesurfer/7.4.1/python/scripts/mri_easyreg", line 180, in main Mref = getM(atlasCOG[:, ok > 0], refCOG[:, ok > 0]) File "/usr/local/freesurfer/7.4.1/python/scripts/mri_easyreg", line 1198, in getM x = np.matmul(np.linalg.inv(np.matmul(np.transpose(A), A)), np.matmul(np.transpose(A), b)) File "<__array_function__ internals>", line 180, in inv File "/usr/local/freesurfer/7.4.1/python/lib/python3.8/site-packages/numpy/linalg/linalg.py", line 552, in inv ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) File "/usr/local/freesurfer/7.4.1/python/lib/python3.8/site-packages/numpy/linalg/linalg.py", line 89, in _raise_linalgerror_singular raise LinAlgError("Singular matrix") numpy.linalg.LinAlgError: Singular matrix
[cid:546a1e09-0300-496f-9c0d-58eb45c8e243]
freesurfer@nmr.mgh.harvard.edu