Closed sj-choi closed 2 months ago
I also attempted it using ANTsRNet. It also stops.
============================================================================= The composite transform comprises the following transforms (in order):
The composite transform comprises the following transforms (in order):
Default pixel value: 0.0000e+00 Interpolation type: LinearInterpolateImageFunction Output warped image: 0x55a9167c9560 Error in dkt_results$segmentationImage : $ operator not defined for this S4 class Calls: antsImageWrite -> check_ants Execution halted
Around 9 gb for this tutorial example. But it looks like you're getting to the end and it's faulting on writing the results to disk. Are you sure it's happening during the actual dkt call?
Do you see any issues in the following that I used to perform DKT labeling?:
NOTE: 'scancode' is a subject ID in a for-loop to handle multiples subjects.
img1 = os.path.join(file_location, f"{scancode}_baseline_lesion_filled_T1W.nii.gz") print(img1) t1 = ants.image_read(img1)
dkt = os.path.join(file_location, "ANTsPyNet_labels", f"{scancode}-DKT.nii.gz") if not os.path.exists(dkt): dkt_results = antspynet.desikan_killiany_tourville_labeling(t1, verbose=True) ants.image_write(dkt_results['segmentation_image'], dkt) else: print(f"{dkt} already exits.")
I did indentation properly. However, it looks like above after copy-and-past.
Before I look at your code or explore your data, I need to be sure that you're able to run the corresponding tutorial example. Have you ran it and did it finish as expected?
Thank you, I will try it first.
dkt seemed to work on the example data in your tutorial link.
I processed the tutorial example image and the code worked well. I used the following code, which is very similar that I provided above:
import os import ants import antspynet
t1 = ants.image_read(antspynet.get_antsxnet_data('mprage_hippmapp3r'))
file_location = "/home/xubuntu/Desktop/test"
print(file_location)
t1_nii = os.path.join(file_location, "ANTsPyNet_tutorial", f"mprage_hippmapp3r.nii.gz")
ants.image_write(t1, t1_nii)
seg = antspynet.deep_atropos(t1, verbose=True)
seg_nii = os.path.join(file_location, "ANTsPyNet_tutorial", f"mprage_hippmapp3r-seg.nii.gz") ants.image_write(seg['segmentation_image'], seg_nii)
dkt = antspynet.desikan_killiany_tourville_labeling(t1, do_lobar_parcellation=True, verbose=True)
dkt_nii = os.path.join(file_location, "ANTsPyNet_tutorial", f"mprage_hippmapp3r-DKT.nii.gz") ants.image_write(dkt['segmentation_image'], dkt_nii)
I'm uncertain whether this was the reason for the unsuccessful outcomes of the prior attempts at DKT labeling. Interestingly, the DKT labeling process was successful when I enabled the do_lobar_parcellation=True
option. However, it failed to work when I didn't use this option.
Are you discussing the tutorial example?
The tutorial example worked. I noticed that the option (do_lobar_parcellation=True) was used in the example and used it on my data, which worked. However, it did not work when I did not use the option.
Did you try that scenario (do_lobar_parcellation=False) on the tutorial data?
Closing as I can't reproduce the error. Reopen if necessary.
I have been testing ANTsPyNet with more RAM. The 'deep' segmentation processes are functioning as expected, except for the DKT labeling. It halts midway and generates certain messages. Due to the extensive length of the screen output, only the final portion is shown below. How much RAM are expected to run DKT labeling?
Input scalar image: 0x9830d550 Could not create ImageIO for the input file, assuming dimension = 3 and scalar pixel type Reference image: 0x22727140
The composite transform comprises the following transforms (in order):
inverse of /tmp/tmpzrfb2a2j0GenericAffine.mat (type = AffineTransform)
Default pixel value: 0.0000e+00 Interpolation type: LinearInterpolateImageFunction Output warped image: 0x21c9cc70 ['-d', '3', '-i', '0x22722b10', '-o', '0x227adb90', '-r', '0x193e9ee0', '-n', 'linear', '-t', '[/tmp/tmpzrfb2a2j0GenericAffine.mat,1]'] Using double precision for computations. Input scalar image: 0x22722b10 Could not create ImageIO for the input file, assuming dimension = 3 and scalar pixel type Reference image: 0x193e9ee0
The composite transform comprises the following transforms (in order):
inverse of /tmp/tmpzrfb2a2j0GenericAffine.mat (type = AffineTransform)
Default pixel value: 0.0000e+00 Interpolation type: LinearInterpolateImageFunction Output warped image: 0x227adb90 Traceback (most recent call last): File "/home/xubuntu/scripts/ANTsPyNet_deep_segmentation_w_BASH_SPRINT_n4_hm_test.py", line 75, in
ants.image_write(dkt_results['segmentation_image'], dkt)
File "/home/xubuntu/anaconda3/envs/py310/lib/python3.10/site-packages/ants/core/ants_image.py", line 583, in getitem
return self._array.getitem(idx)
IndexError: only integers, slices (
:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices