Crop Volume reports error when input is a color volume

Steps to reproduce:

  1. Load any 2D image using “Add Data”;
  2. Go to “Crop Volume” module;
  3. On “Input ROI” select “Create new AnnotationROI”;
  4. Change the ROI to any subregion of the image on the red slice view;
  5. On “Output volume”, select “Create new Volume” item that exists below “Rename current Volume” item (this step is important to reproduce the error);
  6. Click “Apply”;
  7. Nothing will happen and the created volume will have zero dimensions;

If you skip step 5, the error does not happen and the image is cropped successfully.

Using the latest stable release version 4.11.20210226.

The log file accuses the following error:

[ERROR][VTK] 30.03.2021 17:15:12 [vtkSlicerCropVolumeLogic (0000022AEADACDB0)] (D:\D\S\Slicer-1\Modules\Loadable\CropVolume\Logic\vtkSlicerCropVolumeLogic.cxx:141) - CropVolume: output volume (vtkMRMLScalarVolumeNode) is not compatible with input volume (vtkMRMLVectorVolumeNode)

With 4.13.0-2021-03-20 r29789 / 233d7ac, the cropped volume does have the ROI dimensions but is not auto-displayed in the slice views. You can show it using the views’ control widgets. The VTK error you mention does not appear though.

The error message tells that you wanted to store the result of a cropped vector volume (most likely a color image) in a scalar volume. This is not possible.

Currently, the output volume selector only allows pre-creating scalar volumes. I’ll update the output volume selector to allow pre-creating vector volumes and display a more intuitive error message in the module GUI.

For now, if you crop a vector volume then you need to pre-create an output volume elsewhere (e.g., clone the input volume in Data module) or leave the default “Create new volume” setting to let the module create the appropriate output volume type automatically.