oncoray / mirp

Medical Image Radiomics Processor
https://oncoray.github.io/mirp/
European Union Public License 1.2
38 stars 11 forks source link

`slice_id` on `show` attribute function of MIRP Image does is not aware of slice length #82

Closed surajpaib closed 2 months ago

surajpaib commented 2 months ago

Expected behaviour

If slice_id is beyond number of slices, throw an error or a warning and use the maximum slice number

Observed behaviour

MIRP uses the middle slice instead when passed any value beyond the max. slice number

What did MIRP actually do? What error (if any) was produced?

Steps to reproduce the problem

from mirp import deep_learning_preprocessing

processed_data = deep_learning_preprocessing(
    image="path to image",
    mask="path to mask",
    crop_size=[50, 224, 224]
)

image, mask = processed_data[0]
image[0].show(mask=mask[0], slice_id=500)

The above displays slice 26 on the visual panel

Specifications

surajpaib commented 2 months ago

@alexzwanenburg It would be very useful for bug reporters to check the version of MIRP with a call like mirp.__version__

alexzwanenburg commented 2 months ago

@alexzwanenburg It would be very useful for bug reporters to check the version of MIRP with a call like mirp.__version__

The use of __version__ was never accepted in a PEP. Notably, PEP 396 was formally rejected. The pythonic way to get the installed version of MIRP is:

import importlib_metadata
importlib_metadata.version("mirp")

I will add instructions to the bug report template.