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: Represent calculated isodose surfaces as a segmentation node #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Isodose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ string(TOUPPER ${MODULE_NAME} MODULE_NAME_UPPER)
#-----------------------------------------------------------------------------
add_subdirectory(Logic)
add_subdirectory(Widgets)
add_subdirectory(SubjectHierarchyPlugins)

#-----------------------------------------------------------------------------
set(MODULE_EXPORT_DIRECTIVE "Q_SLICER_QTMODULES_${MODULE_NAME_UPPER}_EXPORT")
Expand All @@ -19,8 +18,6 @@ set(MODULE_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/Widgets
${CMAKE_CURRENT_BINARY_DIR}/Widgets
${SlicerRtCommon_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/SubjectHierarchyPlugins
${CMAKE_CURRENT_BINARY_DIR}/SubjectHierarchyPlugins
${qSlicerSubjectHierarchyModuleWidgets_INCLUDE_DIRS}
)

Expand All @@ -44,7 +41,6 @@ set(MODULE_UI_SRCS
set(MODULE_TARGET_LIBRARIES
vtkSlicer${MODULE_NAME}ModuleLogic
vtkSlicer${MODULE_NAME}ModuleWidgets
qSlicer${MODULE_NAME}SubjectHierarchyPlugins
)

set(MODULE_RESOURCES
Expand Down
4 changes: 4 additions & 0 deletions Isodose/Logic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_LOGIC_EXPORT")
set(${KIT}_INCLUDE_DIRECTORIES
${SlicerRtCommon_INCLUDE_DIRS}
${vtkSlicerSubjectHierarchyModuleLogic_INCLUDE_DIRS}
${vtkSlicerSegmentationsModuleMRML_INCLUDE_DIRS}
${vtkSlicerDicomRtImportExportConversionRules_INCLUDE_DIRS}
)

set(${KIT}_SRCS
Expand All @@ -19,6 +21,8 @@ set(${KIT}_SRCS
set(${KIT}_TARGET_LIBRARIES
vtkSlicerRtCommon
vtkSlicerSubjectHierarchyModuleLogic
vtkSlicerSegmentationsModuleMRML
vtkSlicerDicomRtImportExportConversionRules
MRMLCore
${ITK_LIBRARIES}
${VTK_LIBRARIES}
Expand Down
40 changes: 30 additions & 10 deletions Isodose/Logic/vtkMRMLIsodoseNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ vtkMRMLIsodoseNode::vtkMRMLIsodoseNode()
this->DoseUnits = DoseUnitsType::Unknown;
this->ReferenceDoseValue = -1.;
this->RelativeRepresentationFlag = false;
this->BorderMode = BorderModeType::Single;

this->HideFromEditors = false;
}
Expand All @@ -73,6 +74,7 @@ void vtkMRMLIsodoseNode::WriteXML(ostream& of, int nIndent)
vtkMRMLWriteXMLBooleanMacro(ShowScalarBar2D, ShowScalarBar2D);
vtkMRMLWriteXMLBooleanMacro(ShowDoseVolumesOnly, ShowDoseVolumesOnly);
vtkMRMLWriteXMLIntMacro(DoseUnits, DoseUnits);
vtkMRMLWriteXMLIntMacro(BorderMode, BorderMode);
vtkMRMLWriteXMLFloatMacro(ReferenceDoseValue, ReferenceDoseValue);
vtkMRMLWriteXMLBooleanMacro(RelativeRepresentationFlag, RelativeRepresentationFlag);

Expand All @@ -92,6 +94,7 @@ void vtkMRMLIsodoseNode::ReadXMLAttributes(const char** atts)
vtkMRMLReadXMLBooleanMacro(ShowScalarBar2D, ShowScalarBar2D);
vtkMRMLReadXMLBooleanMacro(ShowDoseVolumesOnly, ShowDoseVolumesOnly);
vtkMRMLReadXMLIntMacro(DoseUnits, DoseUnits);
vtkMRMLReadXMLIntMacro(BorderMode, BorderMode);
vtkMRMLReadXMLFloatMacro(ReferenceDoseValue, ReferenceDoseValue);
vtkMRMLReadXMLBooleanMacro(RelativeRepresentationFlag, RelativeRepresentationFlag);
vtkMRMLReadXMLEndMacro();
Expand All @@ -115,6 +118,7 @@ void vtkMRMLIsodoseNode::Copy(vtkMRMLNode *anode)
vtkMRMLCopyBooleanMacro(ShowScalarBar2D);
vtkMRMLCopyBooleanMacro(ShowDoseVolumesOnly);
vtkMRMLCopyIntMacro(DoseUnits);
vtkMRMLCopyIntMacro(BorderMode);
vtkMRMLCopyFloatMacro(ReferenceDoseValue);
vtkMRMLCopyBooleanMacro(RelativeRepresentationFlag);
vtkMRMLCopyEndMacro();
Expand All @@ -134,6 +138,7 @@ void vtkMRMLIsodoseNode::PrintSelf(ostream& os, vtkIndent indent)
vtkMRMLPrintBooleanMacro(ShowScalarBar2D);
vtkMRMLPrintBooleanMacro(ShowDoseVolumesOnly);
vtkMRMLPrintIntMacro(DoseUnits);
vtkMRMLPrintIntMacro(BorderMode);
vtkMRMLPrintFloatMacro(ReferenceDoseValue);
vtkMRMLPrintBooleanMacro(RelativeRepresentationFlag);
vtkMRMLPrintEndMacro();
Expand Down Expand Up @@ -194,15 +199,30 @@ void vtkMRMLIsodoseNode::SetDoseUnits(int doseUnits)
{
switch (doseUnits)
{
case 0:
SetDoseUnits(DoseUnitsType::Gy);
break;
case 1:
SetDoseUnits(DoseUnitsType::Relative);
break;
case -1:
default:
SetDoseUnits(DoseUnitsType::Unknown);
break;
case 0:
this->SetDoseUnits(DoseUnitsType::Gy);
break;
case 1:
this->SetDoseUnits(DoseUnitsType::Relative);
break;
case -1:
default:
this->SetDoseUnits(DoseUnitsType::Unknown);
break;
}
}

//----------------------------------------------------------------------------
void vtkMRMLIsodoseNode::SetBorderMode(int doseBorder)
{
switch (doseBorder)
{
case 2:
this->SetBorderMode(BorderModeType::Double);
break;
case 1:
default:
this->SetBorderMode(BorderModeType::Single);
break;
}
}
12 changes: 12 additions & 0 deletions Isodose/Logic/vtkMRMLIsodoseNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode
{
public:
enum DoseUnitsType { Unknown = -1, Gy = 0, Relative = 1 };
enum BorderModeType {
Single = 1, /// solid shape. Shows dose higher that thesholdMin.
Double = 2 /// hollow shape aka ring-shaped. Shows dose higher than thesholdMin but lower than thesholdMax.
};
static const char* COLOR_TABLE_REFERENCE_ROLE;

static vtkMRMLIsodoseNode *New();
Expand Down Expand Up @@ -103,6 +107,10 @@ class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode
vtkGetMacro(DoseUnits, DoseUnitsType);
vtkSetMacro(DoseUnits, DoseUnitsType);

/// Get/Set dose border mode type
vtkGetMacro(BorderMode, BorderModeType);
vtkSetMacro(BorderMode, BorderModeType);

/// Get/Set relative representation flag
vtkGetMacro(RelativeRepresentationFlag, bool);
vtkSetMacro(RelativeRepresentationFlag, bool);
Expand All @@ -115,6 +123,7 @@ class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode
void operator=(const vtkMRMLIsodoseNode&);

void SetDoseUnits(int doseUnits);
void SetBorderMode(int doseBorder);

protected:
/// State of Show isodose lines checkbox
Expand All @@ -135,6 +144,9 @@ class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode
/// Type of dose units
DoseUnitsType DoseUnits;

/// Type of isodose border surface
BorderModeType BorderMode;

/// Reference dose value
double ReferenceDoseValue;

Expand Down
Loading