question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError: "length_2D" must be smaller or equal to image dimensions after resampling.

See original GitHub issue

Hello,

So I get the following error when I am trying to process an image with version 4.0 of the code. This only occurs with the BF and SEM models.

File "/home/msavage/anaconda3/envs/axonDeepSegEnv1/lib/python3.8/site- packages/ivadomed/loader/mri2d_segmentation_dataset.py", line 152, in prepare_indices raise RuntimeError('"length_2D" must be smaller or equal to image dimensions after resampling.') RuntimeError: "length_2D" must be smaller or equal to image dimensions after resampling.

The image in question is 2160 x 1440 pixels at a resolution of 0.0064 micron per pixel.

The system running this package is Ubuntu 20.04

Any help would be greatly appreciated.

Best,

Michael

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
GrimmSnarkcommented, Mar 9, 2022

Thank you very much for all your advice, the labelling is working much better now!

2reactions
mathieuboudreaucommented, Feb 21, 2022

Thanks @GrimmSnark !

@mariehbourget and I played around a bit with some of the ADS settings on your dataset, and here are some reflections//results:

  • Because of your datasets contrast, we saw better results using the TEM model.
  • Using the TEM model instead of the SEM model changes our internal resolution during segmentation, so there may be less of a need to do padding to avoid the error you were getting with SEM.
  • Using the TEM model with your true resolution of 0.0064 microns, we saw better results in segmenting large axons (at the cost of missing small axons):

LM_58_G_seg-axonmyelin

  • By using the TEM model but changing the input resolution in ADS to 0.0134 (which essentially, what it will be doing is “zooming” in the patches of the images during the segmentation to your image), we saw better results for small axons (at the cost of worse segmentations on your larger axons):

LM_58_G_seg-axonmyelin (1)

  • Applying padding did not provide good results in our tests.

I think the consensus internally in our group is that if we were in your place, it would be better to use a resolution 0.0134 during the segmentation phase only in ADS (note that when creating morphology files, you should use your true resolution value to get accurate values), and then manually correct the segmentation of the large axons using the FSLeyes plugin we provide. Manually fixing/manually segmenting a few large axons is much less time consuming than fixing/manually segmenting many small axons, in our experience.

Hope some of this information is helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Images in subject have different sizes after resampling #354
Hi, I have an image and mask with these properties: Size: 512x512x75 Spacing: 0.703125x0.703125x5.000000 I am adding these to a subject ...
Read more >
SimpleITK Images and Resampling
This quantity implicitly defines the image dimension. ... close do physical attributes (meta-data values) need to be in order to be considered equivalent?...
Read more >
Images dimensions error in python - Stack Overflow
This give n an error: raise ValueError('Input images must have the same dimensions.') ValueError: Input images must have the same dimensions.
Read more >
torchio.transforms.preprocessing.spatial.resample
[docs]class Resample(SpatialTransform): """Resample image to a different physical space. This is a powerful transform that can be used to change the image ......
Read more >
Resampling to volume to smaller size and smaller voxel spacing
I want to downsample my CT images to match their corresponding PET Size, but I also want all my voxel spacing for both...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found