SimpleITK / SlicerSimpleFilters

A Module for Slicer3D to provide a simple GUI to image filters from the Insight Toolkit.
Other
1 stars 12 forks source link

ENH: added support for ScalarVolume inheritant #24

Open kerim371 opened 2 years ago

kerim371 commented 2 years ago

Before that it was impossible to choose ScalarVolume derived as IO node. There was a discoussion on that

lassoan commented 2 years ago

Allowing display of child nodes would make vector and label volumes show up. It would be better to avoid using custom volume type or just add your custom volume type to the list of allowed volume types (e.g., by adding a SimpleFilters configuration variable that would contain a list of additional scalar volume class names).

You may potentially need to change this flag in many other modules in Slicer if you want your custom volume type supported everywhere. Therefore, it would better not have a new scalar volume class. You can use custom attributes, custom display and storage nodes, etc. to customize behavior of a volume node. Do you really need a custom scalar volume node type?

kerim371 commented 2 years ago

@lassoan thank you for feedback

Do you really need a custom scalar volume node type? Yes, it is very attractive module and has sense for geoscience

Can we simply add checkbox enabling/disabling ScalarVolume inheritants and add a tooltip with the description?

Or if this concerns only me then I could fork the repo and build it SlicerCAT using it. I have some tool that helps me to do such things without breaking Superbuild so it should be doable.

lassoan commented 2 years ago

You can just add a module variable that lists all additional volume node classes that will be added to volume node selectors.

kerim371 commented 2 years ago

the problem is that I don't know how to acces this variable member from another module. For example I can add a member variable nodeTypes to FilterParameters class. But how to modify this var from another module? I can get filter module with the command filt_module=slicer.modules.simplefilters but I don't see any method returning instance of that class

lassoan commented 2 years ago

You can do something like this: slicer.modules.SimpleFiltersInstance.scalarVolumeNodeClasses=['vtkMRMLScalarVolumeNode' ]

kerim371 commented 2 years ago

@lassoan thank you, that works!

kerim371 commented 2 years ago

@jcfr please review

kerim371 commented 2 years ago

After reading the associated post, should the following attribute be set ?

inputSelector.showChildNodeTypes = True

Probably this is the most elegant solution but as @pieper said this would allow to choose inapropriate vtkMRMLScalarVolumeNode successor nodes for computation. Probably we should better prevent Slicer users from selecting inapropriate nodes for IO. At the same time we could put information how to add custom volume nodes to Simple Filters somewhere in the developper documentation.