Skip to content

Commit

Permalink
ENH: Represent calculated isodose surfaces as a segmentation node
Browse files Browse the repository at this point in the history
This is a partial solution of the issue #80.
There are two modes of isodose representation have been implemented, single border and double border mode.

Single border mode (solid surface) shows isosurface for dose high than a thresholdMin.

Double border mode (hollow or ring-shaped surface) shows isosurface in dose range from thresholdMin up to thresholdMax.

For example dose values: 10 Gy, 25 Gy, 30 Gy, 50Gy.

  Single border mode will generate isosurfaces: higher than 10Gy, higher
  than 25 Gy, higher than 30 Gy, higher than 50 Gy.

  Double border mode will generate isosurfaces: from 10 Gy to 25 Gy,
  from 25 Gy to 30 Gy, from 30 Gy to 50 Gy.
  • Loading branch information
Michael Colonel committed Jul 9, 2021
1 parent 74cf35b commit 0775c60
Show file tree
Hide file tree
Showing 17 changed files with 328 additions and 497 deletions.
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

0 comments on commit 0775c60

Please sign in to comment.