Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add ability to load custom volume rendering presets #939

Closed

Conversation

cpinter
Copy link
Member

@cpinter cpinter commented Apr 22, 2018

Added the option to use custom presets scene instead of the default one by calling the LoadCustomPresetsScene function of the volume rendering logic. This might be needed for specific applications when only a subset of the presets need to be shown, or if new presets need to be added.

Added showIcons property to the presets combobox classes. This is useful if new presets in the custom presets scene do not have icons, or simply when showing icons are not desired. Default is showing icons.

Added the option to use custom presets scene instead of the default one by calling the LoadCustomPresetsScene function of the volume rendering logic. This might be needed for specific applications when only a subset of the presets need to be shown, or if new presets need to be added.

Added showIcons property to the presets combobox classes. This is useful if new presets in the custom presets scene do not have icons, or simply when showing icons are not desired. Default is showing icons.
@cpinter cpinter requested review from pieper, jcfr and lassoan April 22, 2018 16:25
Copy link
Member

@pieper pieper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@@ -1173,3 +1173,19 @@ void vtkSlicerVolumeRenderingLogic::RemovePreset(vtkMRMLVolumePropertyNode* pres
}
presetScene->RemoveNode(preset);
}

//---------------------------------------------------------------------------
int vtkSlicerVolumeRenderingLogic::LoadCustomPresetsScene(const char* sceneFilePath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper function is not really needed, as you can call clear the scene by simply calling

logic->GetPresetsScene()->Clear();

or import a scene as described here: https://www.slicer.org/wiki/Documentation/Nightly/Modules/VolumeRendering#How_to_register_custom_volume_rendering_presets

but I guess this should work, too:

logic->GetPresetsScene()->SetURL(...);
logic->GetPresetsScene()->Import();

If you think helper functions are needed then it would be better to keep the name and behavior of the called methods. For example, instead of LoadCustomPresersScene() it would be better to name it ImportCustomPresetsScene().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why having a utility function for something is undersired. We have tons of functions that save the developers writing a few lines of code.

"Import" implies that whatever was in the presets scene before stays. This convenience function however imports the file to an empty scene. So the name "load" was intentional.

{
if (!this->PresetsScene)
{
this->PresetsScene = vtkMRMLScene::New();
Copy link
Contributor

@lassoan lassoan Apr 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break GUI updates: all the widgets that are already created would not be updated anymore if presets are added/deleted/modified.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Creating a new scene only happens if the scene was NULL before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, good then.

@cpinter
Copy link
Member Author

cpinter commented Apr 25, 2018

Integrated in Slicer/Slicer@f54d740

@cpinter cpinter closed this Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants