oncoray/mirp

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

surajpaib opened this issue · 2 comments

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

  • MIRP version: 2.2.1
  • Python version: 3.11

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

@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.