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

WIP: ENH: Relative dose representation for isolevels #168

Merged
merged 1 commit into from
Nov 25, 2020
Merged
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
34 changes: 34 additions & 0 deletions Isodose/Logic/vtkMRMLIsodoseNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ vtkMRMLIsodoseNode::vtkMRMLIsodoseNode()
this->ShowScalarBar = false;
this->ShowScalarBar2D = false;
this->ShowDoseVolumesOnly = true;
this->DoseUnits = DoseUnitsType::Unknown;
this->ReferenceDoseValue = -1.;
this->RelativeRepresentationFlag = false;

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

vtkMRMLWriteXMLEndMacro();
}

Expand All @@ -84,6 +91,9 @@ void vtkMRMLIsodoseNode::ReadXMLAttributes(const char** atts)
vtkMRMLReadXMLBooleanMacro(ShowScalarBar, ShowScalarBar);
vtkMRMLReadXMLBooleanMacro(ShowScalarBar2D, ShowScalarBar2D);
vtkMRMLReadXMLBooleanMacro(ShowDoseVolumesOnly, ShowDoseVolumesOnly);
vtkMRMLReadXMLIntMacro(DoseUnits, DoseUnits);
vtkMRMLReadXMLFloatMacro(ReferenceDoseValue, ReferenceDoseValue);
vtkMRMLReadXMLBooleanMacro(RelativeRepresentationFlag, RelativeRepresentationFlag);
vtkMRMLReadXMLEndMacro();

this->EndModify(disabledModify);
Expand All @@ -104,6 +114,9 @@ void vtkMRMLIsodoseNode::Copy(vtkMRMLNode *anode)
vtkMRMLCopyBooleanMacro(ShowScalarBar);
vtkMRMLCopyBooleanMacro(ShowScalarBar2D);
vtkMRMLCopyBooleanMacro(ShowDoseVolumesOnly);
vtkMRMLCopyIntMacro(DoseUnits);
vtkMRMLCopyFloatMacro(ReferenceDoseValue);
vtkMRMLCopyBooleanMacro(RelativeRepresentationFlag);
vtkMRMLCopyEndMacro();

this->EndModify(disabledModify);
Expand All @@ -120,6 +133,9 @@ void vtkMRMLIsodoseNode::PrintSelf(ostream& os, vtkIndent indent)
vtkMRMLPrintBooleanMacro(ShowScalarBar);
vtkMRMLPrintBooleanMacro(ShowScalarBar2D);
vtkMRMLPrintBooleanMacro(ShowDoseVolumesOnly);
vtkMRMLPrintIntMacro(DoseUnits);
vtkMRMLPrintFloatMacro(ReferenceDoseValue);
vtkMRMLPrintBooleanMacro(RelativeRepresentationFlag);
vtkMRMLPrintEndMacro();
}

Expand Down Expand Up @@ -172,3 +188,21 @@ void vtkMRMLIsodoseNode::SetAndObserveColorTableNode(vtkMRMLColorTableNode* node

doseVolumeNode->SetNodeReferenceID(COLOR_TABLE_REFERENCE_ROLE, (node ? node->GetID() : nullptr));
}

//----------------------------------------------------------------------------
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;
}
}
26 changes: 26 additions & 0 deletions Isodose/Logic/vtkMRMLIsodoseNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class vtkMRMLColorTableNode;
class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode
{
public:
enum DoseUnitsType { Unknown = -1, Gy = 0, Relative = 1 };
static const char* COLOR_TABLE_REFERENCE_ROLE;

static vtkMRMLIsodoseNode *New();
Expand Down Expand Up @@ -94,12 +95,27 @@ class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode
vtkSetMacro(ShowDoseVolumesOnly, bool);
vtkBooleanMacro(ShowDoseVolumesOnly, bool);

/// Get/Set reference dose value
vtkGetMacro(ReferenceDoseValue, double);
vtkSetMacro(ReferenceDoseValue, double);

/// Get/Set dose units type
vtkGetMacro(DoseUnits, DoseUnitsType);
vtkSetMacro(DoseUnits, DoseUnitsType);

/// Get/Set relative representation flag
vtkGetMacro(RelativeRepresentationFlag, bool);
vtkSetMacro(RelativeRepresentationFlag, bool);
vtkBooleanMacro(RelativeRepresentationFlag, bool);

protected:
vtkMRMLIsodoseNode();
~vtkMRMLIsodoseNode();
vtkMRMLIsodoseNode(const vtkMRMLIsodoseNode&);
void operator=(const vtkMRMLIsodoseNode&);

void SetDoseUnits(int doseUnits);

protected:
/// State of Show isodose lines checkbox
bool ShowIsodoseLines;
Expand All @@ -115,6 +131,16 @@ class VTK_SLICER_ISODOSE_LOGIC_EXPORT vtkMRMLIsodoseNode : public vtkMRMLNode

/// State of Show dose volumes only checkbox
bool ShowDoseVolumesOnly;

/// Type of dose units
DoseUnitsType DoseUnits;

/// Reference dose value
double ReferenceDoseValue;

/// Whether use relative isolevels representation
/// for absolute dose (Gy) and unknown units or not
bool RelativeRepresentationFlag;
};

#endif
Loading