Skip to content

Error with Nifti Images. #84

Description

@umgpy

Hi I was trying the collage module on the example jupyter notebook through the docker image. However on trying to pass a numpy array of a nifti image, collage.execute() results in an error. I am adding the error below, please let me know if anything more is required to replicate this error. Thanks

use_3D = True
...
print(image_data.shape)

>(183, 250, 250)

Error while calculating the collage features.

# Run CoLlage Algorithm.Prepare

full_images = collage.execute()

>Image shape = (183, 250, 250)
Mask size = 54x62x61
Image shape (cropped and padded) = (64, 72, 63)
Note: Dividing image values by 255 to convert to 0-1 range
Calculating pixel gradients:
Calculating pixel gradients done.
Calculating dominant gradient angles using SVD for each image patch of size 5x5
Window patch shape for dominant angle calculation = (11, 11, 1)
Calculating dominant gradient angles done.
Dominant angles shape = (54, 62, 63, 2)
Calculating haralick features of angles:
Calculating features for angle 0:
Rescaling dominant angles to 64 unique values.
Rescaling dominant angles done.

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-157-f386c7d9cfe2> in <module>
      1 # Run CoLlage Algorithm.Prepare
----> 2 full_images = collage.execute()

/usr/local/lib/python3.8/dist-packages/collageradiomics.py in execute(self)
    565         for angle_index in range(angles_shape[3]):
    566             print(f'Calculating features for angle {angle_index}:')
--> 567             haralick_features[:,:,:,:,angle_index] = self.calculate_haralick_textures(dominant_angles[:,:,:,angle_index])
    568             print(f'Calculating features for angle {angle_index} done.')
    569         if self.verbose_logging:

/usr/local/lib/python3.8/dist-packages/collageradiomics.py in calculate_haralick_textures(self, dominant_angles)
    484         for z in range(depth):
    485             for y,x in product(range(height), range(width)):
--> 486                 if self.mask_array[y,x,z]:
    487                     haralick_image[y,x,z,:] = self.calculate_haralick_feature_values(dominant_angles_binned[:,:,z], x, y)
    488 

IndexError: index 61 is out of bounds for axis 2 with size 61

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting responseIssue is awaiting a response, such as confirmation that a bug has been fixed.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions