You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Above is the file structure of my dataset where segmentation.nii.gz and imaging.nii.gz are 3D NIFTI files with multiple slices. Also, I'm using code resembling the piece below to load the dataset.
I'm especially worried about my training data loading because I had to change the slice_axis in the NIFTIslicer_interface init for the sample_data size to be correct while following this tutorial.
When I run sample = data_io.sample_loader("scan_c", load_seg=True), I get a Sample of shape (H, W, N, C). N is my number of slices and my C = 1.
I found visualize_samples but I think it may be bugged. At this line, it tries to convert the sample to grayscale, even though my num of channels is 1, which leads to an IndexError. Here are the code and error respectively.
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/nwogu/OneDrive/Documents/4mLab/MIScnn-UNet/data_io.py", line 39, in <module>
visualize_samples([sample], mask_seg=True, mask_pred=False)
File "C:\Users\nwogu\AppData\Local\Programs\Python\Python39\lib\site-packages\miscnn\utils\visualizer.py", line 154, in visualize_samples
sample.img_data = normalize(sample.img_data, to_greyscale=True, normalize=True)
File "C:\Users\nwogu\AppData\Local\Programs\Python\Python39\lib\site-packages\miscnn\utils\visualizer.py", line 99, in normalize
return normalize_volume(sample, to_greyscale, normalize)
File "C:\Users\nwogu\AppData\Local\Programs\Python\Python39\lib\site-packages\miscnn\utils\visualizer.py", line 48, in normalize_volume
img[:, :, :] = vec_luminosity(img[:, :, :, 0], img[:, :, :, 1], img[:, :, :, 2])
IndexError: index 1 is out of bounds for axis 3 with size 1
I may be misusing it though, I am not sure. Please, let me know. :)
As an aside but kinda related, I tried writing my own visualize_samples but I could not find the definition of overlay_segmentation as used here.
The text was updated successfully, but these errors were encountered:
visualize_samples() is bugged as I came to find out from #155. It does seem you are fixing it (#156). Thanks :)
I believe there's another bug that may be missed though. I found this because my data is grayscaled so only one channel. This line in visualize_samples() has the to_greyscale parameter hardcoded as True. Unfortunately, this causes an IndexErrorhere when the img_data is grayscale. Here's an example error dump where my img_data has the shape (370, 512, 256, 1) following the (N, H, W, C) format:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/nwogu/OneDrive/Documents/4mLab/MIScnn-UNet/visualize_results.py", line 109, in <module>
visualize_samples([sample], out_dir=evaluation_path, mask_seg=True, mask_pred=True,
File "C:\Users\nwogu\AppData\Local\Programs\Python\Python39\lib\site-packages\miscnn\utils\visualizer.py", line 154, in visualize_samples
sample.img_data = normalize(sample.img_data, to_greyscale=True, normalize=True)
File "C:\Users\nwogu\AppData\Local\Programs\Python\Python39\lib\site-packages\miscnn\utils\visualizer.py", line 99, in normalize
return normalize_volume(sample, to_greyscale, normalize)
File "C:\Users\nwogu\AppData\Local\Programs\Python\Python39\lib\site-packages\miscnn\utils\visualizer.py", line 48, in normalize_volume
img[:, :, :] = vec_luminosity(img[:, :, :, 0], img[:, :, :, 1], img[:, :, :, 2])
IndexError: index 1 is out of bounds for axis 3 with size 1
python-BaseException
Above is the file structure of my dataset where segmentation.nii.gz and imaging.nii.gz are 3D NIFTI files with multiple slices. Also, I'm using code resembling the piece below to load the dataset.
I'm especially worried about my training data loading because I had to change the
slice_axis
in theNIFTIslicer_interface
init for the sample_data size to be correct while following this tutorial.When I run
sample = data_io.sample_loader("scan_c", load_seg=True)
, I get aSample
of shape (H, W, N, C). N is my number of slices and my C = 1.I found
visualize_samples
but I think it may be bugged. At this line, it tries to convert the sample to grayscale, even though my num of channels is 1, which leads to an IndexError. Here are the code and error respectively.Error:
I may be misusing it though, I am not sure. Please, let me know. :)
As an aside but kinda related, I tried writing my own
visualize_samples
but I could not find the definition ofoverlay_segmentation
as used here.The text was updated successfully, but these errors were encountered: