Skip to content

Commit

Permalink
DOC: Issue Slicer#7179 Curved Planar Reformation to do
Browse files Browse the repository at this point in the history
  • Loading branch information
Leengit committed Nov 25, 2024
1 parent 606460a commit 2ace9ac
Show file tree
Hide file tree
Showing 22 changed files with 166 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Libs/MRML/Core/Testing/vtkMRMLSliceNodeTest1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ int InitializeDefaultMatrixTest();
int SlabReconstructionEnabledTest();
int SlabReconstructionTypeTest();
int SlabReconstructionThicknessTest();
// TODO: Declare tests for curved planar reformation

//----------------------------------------------------------------------------
int vtkMRMLSliceNodeTest1(int , char * [] )
Expand All @@ -54,6 +55,7 @@ int vtkMRMLSliceNodeTest1(int , char * [] )
CHECK_EXIT_SUCCESS(SlabReconstructionEnabledTest());
CHECK_EXIT_SUCCESS(SlabReconstructionTypeTest());
CHECK_EXIT_SUCCESS(SlabReconstructionThicknessTest());
// TODO: Invoke tests for curved planar reformation

return EXIT_SUCCESS;
}
Expand Down Expand Up @@ -516,3 +518,5 @@ int SlabReconstructionThicknessTest()

return EXIT_SUCCESS;
}

// TODO: Define tests for curved planar reformation
4 changes: 4 additions & 0 deletions Libs/MRML/Core/vtkMRMLSliceDisplayNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class VTK_MRML_EXPORT vtkMRMLSliceDisplayNode : public vtkMRMLModelDisplayNode
vtkBooleanMacro(IntersectingSlicesRotationEnabled, bool);
//@}

// TODO: Add macros for curved planar reformation

enum IntersectingSlicesInteractiveMode
{
ModeRotation,
Expand Down Expand Up @@ -173,6 +175,7 @@ class VTK_MRML_EXPORT vtkMRMLSliceDisplayNode : public vtkMRMLModelDisplayNode
ComponentTranslateSingleIntersectingSliceHandle, ///< mouse is near the middle of the slice intersection (translation section)
ComponentSliceIntersection, ///< slice intersection is active (not any handle), e.g., because user is interacting with the widget
ComponentTranslateIntersectingThickSlabHandle, ///< mouse is near the handle for adjusting a thick slab
/* TODO: Add component for curved planar reformation? */
Component_Last
};

Expand Down Expand Up @@ -223,6 +226,7 @@ class VTK_MRML_EXPORT vtkMRMLSliceDisplayNode : public vtkMRMLModelDisplayNode
bool IntersectingSlicesRotationEnabled{ true };
bool IntersectingThickSlabInteractive{ false };
bool IntersectingThickSlabVisibility{ false };
// TODO: Add members, with initializers, for curved planar reformation

int IntersectingSlicesInteractiveHandlesVisibilityMode{ NeverVisible };

Expand Down
13 changes: 13 additions & 0 deletions Libs/MRML/Core/vtkMRMLSliceNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ vtkMRMLSliceNode::vtkMRMLSliceNode()
this->SlabReconstructionThickness = 1.;
this->SlabReconstructionOversamplingFactor = 2.0;

// TODO: Initialize member variables associated with curved planar reformation

this->XYZOrigin[0] = 0;
this->XYZOrigin[1] = 0;
this->XYZOrigin[2] = 0;
Expand Down Expand Up @@ -924,6 +926,8 @@ void vtkMRMLSliceNode::WriteXML(ostream& of, int nIndent)
vtkMRMLWriteXMLFloatMacro(slabReconstructionThickness, SlabReconstructionThickness);
vtkMRMLWriteXMLFloatMacro(slabReconstructionOversamplingFactor, SlabReconstructionOversamplingFactor);

// TODO: Write member variables associated with curved planar reformation

vtkMRMLWriteXMLEndMacro();
}

Expand Down Expand Up @@ -1016,6 +1020,8 @@ void vtkMRMLSliceNode::ReadXMLAttributes(const char** atts)
vtkMRMLReadXMLFloatMacro(slabReconstructionThickness, SlabReconstructionThickness);
vtkMRMLReadXMLFloatMacro(slabReconstructionOversamplingFactor, SlabReconstructionOversamplingFactor);

// TODO: Read member variables associated with curved planar reformation

vtkMRMLReadXMLEndMacro();

if (!layoutColorFound)
Expand Down Expand Up @@ -1136,6 +1142,8 @@ void vtkMRMLSliceNode::CopyContent(vtkMRMLNode* anode, bool deepCopy/*=true*/)

vtkMRMLCopyEndMacro();

// TODO: Copy member variables associated with curved planar reformation

this->UpdateMatrices();
}

Expand Down Expand Up @@ -1233,6 +1241,8 @@ void vtkMRMLSliceNode::PrintSelf(ostream& os, vtkIndent indent)
vtkMRMLPrintFloatMacro(SlabReconstructionThickness);
vtkMRMLPrintFloatMacro(SlabReconstructionOversamplingFactor);

// TODO: Print member variables associated with curved planar reformation

vtkMRMLPrintEndMacro();
}

Expand Down Expand Up @@ -2095,6 +2105,9 @@ int vtkMRMLSliceNode::GetSlabReconstructionTypeFromString(const char* name)
return -1;
}

//-----------------------------------------------------------
// TODO: Add function definitions associated with curved planar reformation

//-----------------------------------------------------------
vtkImplicitFunction* vtkMRMLSliceNode::GetImplicitFunctionWorld()
{
Expand Down
6 changes: 6 additions & 0 deletions Libs/MRML/Core/vtkMRMLSliceNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
/// SliceVisibleFlag = broadcast display of slice in 3D
/// ResetOrientationFlag = broadcast a reset to default orientation to all linked viewers
/// UpdateSlabReconstructionThicknessFlag = broadcast updating the slab reconstruction thickness
/// TODO: Add any flags associated with curved planar reformation
enum InteractionFlagType
{
None = 0,
Expand All @@ -486,6 +487,7 @@ class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
ResetOrientationFlag = 512,
RotateToBackgroundVolumePlaneFlag = 1024,
UpdateSlabReconstructionThicknessFlag = 2048,
// TODO: Add any flags associated with curved planar reformation
};

/// Get/Set a flag indicating what parameters are being manipulated
Expand Down Expand Up @@ -554,6 +556,8 @@ class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
vtkSetMacro(SlabReconstructionOversamplingFactor, double);
/// @}

/// TODO: Add vtkGetMacro and vtkSetMacro associated with curved planar reformation

virtual vtkImplicitFunction* GetImplicitFunctionWorld();

protected:
Expand Down Expand Up @@ -596,6 +600,8 @@ class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
double SlabReconstructionThickness;
double SlabReconstructionOversamplingFactor;

// TODO: Add member variables associated with curved planar reformation

// Hold the string returned by GetOrientationString
std::string OrientationString;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ static const double INTERSECTION_LINE_RESOLUTION = 50; // default = 8
// Thick slab line
static const double THICK_SLAB_LINE_RESOLUTION = 50; // default = 8

// TODO: Curved planar reformation settings

// Handles
static const double HANDLES_CIRCLE_THETA_RESOLUTION = 100; // default = 8
static const double HANDLES_CIRCLE_PHI_RESOLUTION = 100; // default = 8
Expand All @@ -93,6 +95,7 @@ static const double THICK_SLAB_TRANSLATION_HANDLE_DEFAULT_ORIENTATION[3] = { 0.0
static const double THICK_SLAB_TRANSLATION_HANDLE_ARROW_RADIUS = 3.0;
static const double THICK_SLAB_TRANSLATION_HANDLE_ARROW_LENGTH = 60.0;
static const double THICK_SLAB_TRANSLATION_HANDLE_ARROW_TIP_ANGLE = 27; // degrees
// TODO: Curved planar reformation handles
static const double ROTATION_HANDLE_DEFAULT_POSITION[3] = { 0.0,0.0,0.0 };
static const double ROTATION_HANDLE_DEFAULT_ORIENTATION[3] = { 0.0,1.0,0.0 };
static const double ROTATION_HANDLE_CIRCLE_RADIUS = 10.0;
Expand Down Expand Up @@ -184,6 +187,8 @@ class SliceIntersectionInteractionDisplayPipeline
this->ThickSlabLine2SecondHalfActor->SetMapper(this->ThickSlabLine2SecondHalfMapper);
this->ThickSlabLine2SecondHalfActor->SetProperty(this->ThickSlabLine2SecondHalfProperty);

// TODO: Curved planar reformation

// Center sphere
this->TranslationOuterHandle = vtkSmartPointer<vtkSphereSource>::New();
this->TranslationOuterHandle->SetRadius(TRANSLATION_HANDLE_OUTER_RADIUS);
Expand Down Expand Up @@ -217,12 +222,14 @@ class SliceIntersectionInteractionDisplayPipeline
this->SetIntersectionHandlesVisibility(false);
this->SetThickSlabHandlesVisibility(false);
this->NeedToRender = true;
// TODO: Curved planar reformation

// Handle points
this->RotationHandlePoints = vtkSmartPointer<vtkPolyData>::New();
this->TranslationHandlePoints = vtkSmartPointer<vtkPolyData>::New();
this->SliceOffsetHandlePoints = vtkSmartPointer<vtkPolyData>::New();
this->ThickSlabHandlePoints = vtkSmartPointer<vtkPolyData>::New();
// TODO: Curved planar reformation
}

//----------------------------------------------------------------------
Expand Down Expand Up @@ -883,6 +890,9 @@ class SliceIntersectionInteractionDisplayPipeline
this->ThickSlabLine2Handle2Points->InsertNextPoint(coneBaseL);
}

//----------------------------------------------------------------------
// TODO: Define method for curved planar reformation handles

//----------------------------------------------------------------------
void SetAndObserveSliceLogic(vtkMRMLSliceLogic* sliceLogic, vtkCallbackCommand* callback)
{
Expand Down Expand Up @@ -911,6 +921,7 @@ class SliceIntersectionInteractionDisplayPipeline
pc->AddItem(this->ThickSlabLine1SecondHalfActor);
pc->AddItem(this->ThickSlabLine2FirstHalfActor);
pc->AddItem(this->ThickSlabLine2SecondHalfActor);
// TODO: Curved planar reformation actors
pc->AddItem(this->TranslationOuterHandleActor);
pc->AddItem(this->TranslationInnerHandleActor);
pc->AddItem(this->RotationHandle1Actor);
Expand All @@ -921,6 +932,7 @@ class SliceIntersectionInteractionDisplayPipeline
pc->AddItem(this->ThickSlabLine1Handle2Actor);
pc->AddItem(this->ThickSlabLine2Handle1Actor);
pc->AddItem(this->ThickSlabLine2Handle2Actor);
// TODO: Curved planar reformation handle actors
}

//----------------------------------------------------------------------
Expand All @@ -936,6 +948,7 @@ class SliceIntersectionInteractionDisplayPipeline
renderer->AddViewProp(this->ThickSlabLine1SecondHalfActor);
renderer->AddViewProp(this->ThickSlabLine2FirstHalfActor);
renderer->AddViewProp(this->ThickSlabLine2SecondHalfActor);
// TODO: Curved planar reformation actors
renderer->AddViewProp(this->TranslationOuterHandleActor);
renderer->AddViewProp(this->TranslationInnerHandleActor);
renderer->AddViewProp(this->RotationHandle1Actor);
Expand All @@ -946,6 +959,7 @@ class SliceIntersectionInteractionDisplayPipeline
renderer->AddViewProp(this->ThickSlabLine1Handle2Actor);
renderer->AddViewProp(this->ThickSlabLine2Handle1Actor);
renderer->AddViewProp(this->ThickSlabLine2Handle2Actor);
// TODO: Curved planar reformation handle actors
}

//----------------------------------------------------------------------
Expand All @@ -957,6 +971,7 @@ class SliceIntersectionInteractionDisplayPipeline
this->ThickSlabLine1SecondHalfActor->ReleaseGraphicsResources(win);
this->ThickSlabLine2FirstHalfActor->ReleaseGraphicsResources(win);
this->ThickSlabLine2SecondHalfActor->ReleaseGraphicsResources(win);
// TODO: Curved planar reformation graphic resources
this->TranslationOuterHandleActor->ReleaseGraphicsResources(win);
this->TranslationInnerHandleActor->ReleaseGraphicsResources(win);
this->RotationHandle1Actor->ReleaseGraphicsResources(win);
Expand All @@ -967,6 +982,7 @@ class SliceIntersectionInteractionDisplayPipeline
this->ThickSlabLine1Handle2Actor->ReleaseGraphicsResources(win);
this->ThickSlabLine2Handle1Actor->ReleaseGraphicsResources(win);
this->ThickSlabLine2Handle2Actor->ReleaseGraphicsResources(win);
// TODO: Curved planar reformation handle graphic resources
}

//----------------------------------------------------------------------
Expand All @@ -982,6 +998,7 @@ class SliceIntersectionInteractionDisplayPipeline
renderer->RemoveViewProp(this->ThickSlabLine1SecondHalfActor);
renderer->RemoveViewProp(this->ThickSlabLine2FirstHalfActor);
renderer->RemoveViewProp(this->ThickSlabLine2SecondHalfActor);
// TODO: Remove curved planar reformation actors
renderer->RemoveViewProp(this->TranslationOuterHandleActor);
renderer->RemoveViewProp(this->TranslationInnerHandleActor);
renderer->RemoveViewProp(this->RotationHandle1Actor);
Expand All @@ -992,6 +1009,7 @@ class SliceIntersectionInteractionDisplayPipeline
renderer->RemoveViewProp(this->ThickSlabLine1Handle2Actor);
renderer->RemoveViewProp(this->ThickSlabLine2Handle1Actor);
renderer->RemoveViewProp(this->ThickSlabLine2Handle2Actor);
// TODO: Remove curved planar reformation handle actors
}

//----------------------------------------------------------------------
Expand Down Expand Up @@ -1022,6 +1040,7 @@ class SliceIntersectionInteractionDisplayPipeline
{
this->ThickSlabLine2SecondHalfActor->RenderOverlay(viewport);
}
// TODO: render overlay for curved planar reformation actors
if (this->TranslationOuterHandleActor->GetVisibility())
{
this->TranslationOuterHandleActor->RenderOverlay(viewport);
Expand Down Expand Up @@ -1062,6 +1081,7 @@ class SliceIntersectionInteractionDisplayPipeline
{
this->ThickSlabLine2Handle2Actor->RenderOverlay(viewport);
}
// TODO: render overlay for curved planar reformation handle actors
this->NeedToRender = false;
return count;
}
Expand Down Expand Up @@ -1147,6 +1167,9 @@ class SliceIntersectionInteractionDisplayPipeline
this->ThickSlabLine2Handle2Actor->SetVisibility(thickSlabLine2Handle2Visible);
}

//----------------------------------------------------------------------
// TODO: set visibility for curved planar reformation handles

//----------------------------------------------------------------------
void SetHandlesOpacity(double opacity)
{
Expand All @@ -1170,9 +1193,13 @@ class SliceIntersectionInteractionDisplayPipeline
return this->ThickSlabLine1FirstHalfActor->GetVisibility();
}

//----------------------------------------------------------------------
// TODO: Get curved planar reformation visibility?

//----------------------------------------------------------------------
bool GetVisibility()
{
// TODO: Include curved planar reformation visibility?
return this->GetIntersectionVisibility() || this->GetThickSlabVisibility();
}

Expand Down Expand Up @@ -1208,6 +1235,8 @@ class SliceIntersectionInteractionDisplayPipeline
vtkSmartPointer<vtkProperty2D> ThickSlabLine2SecondHalfProperty;
vtkSmartPointer<vtkActor2D> ThickSlabLine2SecondHalfActor;

// TODO: vtkSmartPionters for curved planar reformation

vtkSmartPointer<vtkSphereSource> TranslationOuterHandle;
vtkSmartPointer<vtkPolyDataMapper2D> TranslationOuterHandleMapper;
vtkSmartPointer<vtkProperty2D> TranslationOuterHandleProperty;
Expand Down Expand Up @@ -1273,6 +1302,7 @@ class SliceIntersectionInteractionDisplayPipeline
vtkSmartPointer<vtkProperty2D> ThickSlabLine2Handle2Property;
vtkSmartPointer<vtkActor2D> ThickSlabLine2Handle2Actor;

// TODO: vtkSmartPionters for curved planar reformation handles

vtkWeakPointer<vtkMRMLSliceLogic> SliceLogic;
vtkWeakPointer<vtkCallbackCommand> Callback;
Expand All @@ -1282,6 +1312,8 @@ class SliceIntersectionInteractionDisplayPipeline
vtkSmartPointer<vtkPolyData> SliceOffsetHandlePoints;
vtkSmartPointer<vtkPolyData> ThickSlabHandlePoints;

// TODO: vtkSmartPionters for curved planar reformation handle points?

vtkSmartPointer<vtkPoints> SliceOffsetHandle1Points;
vtkSmartPointer<vtkPoints> SliceOffsetHandle2Points;
vtkSmartPointer<vtkPoints> RotationHandle1Points;
Expand All @@ -1291,7 +1323,6 @@ class SliceIntersectionInteractionDisplayPipeline
vtkSmartPointer<vtkPoints> ThickSlabLine2Handle1Points;
vtkSmartPointer<vtkPoints> ThickSlabLine2Handle2Points;


bool SliceOffsetHandle1Displayable = false;
bool SliceOffsetHandle2Displayable = false;
bool RotationHandle1Displayable = false;
Expand All @@ -1303,6 +1334,7 @@ class SliceIntersectionInteractionDisplayPipeline
bool RotationHandlesVisible = false;
bool TranslationHandlesVisible = false;
bool ThickSlabHandlesVisible = false;
// TODO: Initialize for curved planar reformation
int HandlesVisibilityMode = vtkMRMLSliceDisplayNode::NeverVisible;
int SliceIntersectionMode = vtkMRMLSliceDisplayNode::SkipLineCrossings;
// Indicates that this representation has changed and thus re-rendering is needed
Expand Down Expand Up @@ -1495,6 +1527,7 @@ void vtkMRMLSliceIntersectionInteractionRepresentation::UpdateSliceIntersectionD
pipeline->SetThicknessVisibility(false);
pipeline->SetIntersectionHandlesVisibility(false);
pipeline->SetThickSlabHandlesVisibility(false);
// TODO: Pipeline visibility for curved planar reformation?
if (pipeline->NeedToRender)
{
this->NeedToRenderOn();
Expand All @@ -1510,6 +1543,7 @@ void vtkMRMLSliceIntersectionInteractionRepresentation::UpdateSliceIntersectionD
pipeline->SetThicknessVisibility(false);
pipeline->SetIntersectionHandlesVisibility(false);
pipeline->SetThickSlabHandlesVisibility(false);
// TODO: Pipeline visibility for curved planar reformation?
if (pipeline->NeedToRender)
{
this->NeedToRenderOn();
Expand All @@ -1523,6 +1557,8 @@ void vtkMRMLSliceIntersectionInteractionRepresentation::UpdateSliceIntersectionD
bool showInteractiveSliceIntersectionLines = displayNode->GetIntersectingSlicesVisibility();
bool showInteractiveSliceHandles = showInteractiveSliceIntersectionLines && displayNode->GetIntersectingSlicesInteractive();

// TODO: bool members for curved planar reformation handles?

bool isInteractive = displayNode->GetIntersectingThickSlabInteractive() || displayNode->GetIntersectingSlicesInteractive();
if (!((showThickSlabLines || showInteractiveSliceIntersectionLines) && isInteractive))
{
Expand All @@ -1531,6 +1567,7 @@ void vtkMRMLSliceIntersectionInteractionRepresentation::UpdateSliceIntersectionD
pipeline->SetThicknessVisibility(false);
pipeline->SetIntersectionHandlesVisibility(false);
pipeline->SetThickSlabHandlesVisibility(false);
// TODO: Pipeline visibility for curved planar reformation?
if (pipeline->NeedToRender)
{
this->NeedToRenderOn();
Expand Down Expand Up @@ -2221,6 +2258,7 @@ void vtkMRMLSliceIntersectionInteractionRepresentation::UpdateSliceIntersectionD
pipeline->SetThickSlabHandlesVisibility(false);
pipeline->SetThicknessVisibility(false);
}
// TODO: Process curved planar reformation?
this->NeedToRenderOn();
}

Expand Down Expand Up @@ -2643,6 +2681,7 @@ std::string vtkMRMLSliceIntersectionInteractionRepresentation::CanInteract(vtkMR
vtkMRMLSliceNode* intersectingSliceNode = (*sliceIntersectionIt)->SliceLogic->GetSliceNode();
vtkMRMLSliceDisplayNode* intersectingDisplayNode = this->GetSliceDisplayNode(intersectingSliceNode);
bool thickSlabInteractionEnabled = intersectingDisplayNode->GetIntersectingThickSlabInteractive();
// TODO: Also check whether curved planar reformation is enabled?
double opacity = 0.0;
HandleInfoList handleInfoList = this->GetHandleInfoList((*sliceIntersectionIt));
for (HandleInfo handleInfo : handleInfoList)
Expand Down Expand Up @@ -2842,6 +2881,8 @@ vtkMRMLSliceIntersectionInteractionRepresentation::GetHandleInfoList(SliceInters
handleInfoList.push_back(info);
}

// TODO: Also look at curve planar reformation?

return handleInfoList;
}

Expand Down Expand Up @@ -2920,6 +2961,7 @@ void vtkMRMLSliceIntersectionInteractionRepresentation::SetPipelinesHandlesVisib
}
(*sliceIntersectionIt)->SetIntersectionHandlesVisibility(visible);
(*sliceIntersectionIt)->SetThickSlabHandlesVisibility(visible);
// TODO: Also curved planar reformation?
if ((*sliceIntersectionIt)->NeedToRender)
{
this->NeedToRenderOn();
Expand Down
Loading

0 comments on commit 2ace9ac

Please sign in to comment.