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

Add a parameter set selector and append the result in a table. #133

Open
wants to merge 1 commit 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: 4 additions & 0 deletions StenosisMeasurement3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ string(TOUPPER ${MODULE_NAME} MODULE_NAME_UPPER)

#-----------------------------------------------------------------------------
add_subdirectory(Logic)
add_subdirectory(MRML)
add_subdirectory(Widgets)

#-----------------------------------------------------------------------------
Expand All @@ -18,6 +19,8 @@ set(MODULE_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR}/Logic
${CMAKE_CURRENT_SOURCE_DIR}/Widgets
${CMAKE_CURRENT_BINARY_DIR}/Widgets
${CMAKE_CURRENT_SOURCE_DIR}/MRML
${CMAKE_CURRENT_BINARY_DIR}/MRML
${ExtraMarkups_ModuleMRML_INCLUDE_DIRS}
)

Expand All @@ -38,6 +41,7 @@ set(MODULE_UI_SRCS
)

set(MODULE_TARGET_LIBRARIES
vtkSlicer${MODULE_NAME}ModuleMRML
vtkSlicer${MODULE_NAME}ModuleLogic
qSlicer${MODULE_NAME}ModuleWidgets
vtkSlicerMarkupsModuleMRML
Expand Down
1 change: 1 addition & 0 deletions StenosisMeasurement3D/Logic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_MODULE_LOGIC_EXPORT

set(${KIT}_INCLUDE_DIRECTORIES
${ExtraMarkups_ModuleMRML_INCLUDE_DIRS}
${vtkSlicer${MODULE_NAME}ModuleMRML_INCLUDE_DIRS}
)

set(${KIT}_SRCS
Expand Down
317 changes: 278 additions & 39 deletions StenosisMeasurement3D/Logic/vtkSlicerStenosisMeasurement3DLogic.cxx

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions StenosisMeasurement3D/Logic/vtkSlicerStenosisMeasurement3DLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <vtkMRMLMarkupsShapeNode.h>
#include <vtkMRMLMarkupsFiducialNode.h>
#include <vtkMRMLSegmentationNode.h>
#include "vtkMRMLStenosisMeasurement3DParameterNode.h"
#include <vtkVariantArray.h>

/// \ingroup Slicer_QtModules_ExtensionTemplate
class VTK_SLICER_STENOSISMEASUREMENT3D_MODULE_LOGIC_EXPORT vtkSlicerStenosisMeasurement3DLogic :
Expand All @@ -49,12 +51,16 @@ class VTK_SLICER_STENOSISMEASUREMENT3D_MODULE_LOGIC_EXPORT vtkSlicerStenosisMeas

bool UpdateBoundaryControlPointPosition(int pointIndex, vtkMRMLMarkupsFiducialNode * fiducialNode,
vtkMRMLMarkupsShapeNode * shapeNode);
double Process(vtkMRMLMarkupsShapeNode * wall,
vtkMRMLSegmentationNode * lumen, std::string segmentID,
vtkMRMLMarkupsFiducialNode * boundary,
vtkPolyData * wallOpenOut, vtkPolyData * lumenOpenOut,
vtkPolyData * wallClosedOut, vtkPolyData * lumenClosedOut);
bool Process(vtkVariantArray * results);


void ProcessMRMLNodesEvents(vtkObject *caller,
unsigned long event,
void *callData ) override;

vtkMRMLStenosisMeasurement3DParameterNode * GetParameterNode() {return ParameterNode;}
void SetParameterNode(vtkMRMLStenosisMeasurement3DParameterNode * parameterNode);

protected:
vtkSlicerStenosisMeasurement3DLogic();
~vtkSlicerStenosisMeasurement3DLogic() override;
Expand All @@ -74,6 +80,10 @@ class VTK_SLICER_STENOSISMEASUREMENT3D_MODULE_LOGIC_EXPORT vtkSlicerStenosisMeas
double * startOrigin, double * startNormal, double * endOrigin, double * endNormal);
double CalculateClippedSplineLength(vtkMRMLMarkupsFiducialNode * fiducialNode,
vtkMRMLMarkupsShapeNode * shapeNode);
bool DefineOutputTable();
bool ComputeResults(vtkVariantArray * results);

vtkWeakPointer<vtkMRMLStenosisMeasurement3DParameterNode> ParameterNode;
private:

vtkSlicerStenosisMeasurement3DLogic(const vtkSlicerStenosisMeasurement3DLogic&); // Not implemented
Expand Down
27 changes: 27 additions & 0 deletions StenosisMeasurement3D/MRML/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
project(vtkSlicer${MODULE_NAME}ModuleMRML)

set(KIT ${PROJECT_NAME})

set(${KIT}_EXPORT_DIRECTIVE "VTK_SLICER_${MODULE_NAME_UPPER}_MODULE_MRML_EXPORT")

set(${KIT}_INCLUDE_DIRECTORIES
${ExtraMarkups_ModuleMRML_INCLUDE_DIRS}
)

set(${KIT}_SRCS
vtkMRML${MODULE_NAME}ParameterNode.cxx
vtkMRML${MODULE_NAME}ParameterNode.h
)

set(${KIT}_TARGET_LIBRARIES
${MRML_LIBRARIES}
)

#-----------------------------------------------------------------------------
SlicerMacroBuildModuleMRML(
NAME ${KIT}
EXPORT_DIRECTIVE ${${KIT}_EXPORT_DIRECTIVE}
INCLUDE_DIRECTORIES ${${KIT}_INCLUDE_DIRECTORIES}
SRCS ${${KIT}_SRCS}
TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
#include "vtkMRMLStenosisMeasurement3DParameterNode.h"

// VTK includes
#include <vtkNew.h>
#include <vtkObjectFactory.h>

// MRML includes
#include <vtkMRMLMarkupsShapeNode.h>
#include <vtkMRMLMarkupsFiducialNode.h>
#include <vtkMRMLSegmentationNode.h>
#include <vtkMRMLModelNode.h>
#include <vtkMRMLTableNode.h>

static const char* InputShapeNodeReferenceRole = "inputShape";
static const char* InputFiducialNodeReferenceRole = "inputFiducial";
static const char* InputSegmentationNodeReferenceRole = "inputSegmentation";
static const char* OutputWallModelNodeReferenceRole = "outputWallModel";
static const char* OutputLumenModelNodeReferenceRole = "outputLumenModel";
static const char* OutputTableNodeReferenceRole = "outputTable";

//----------------------------------------------------------------------------
vtkMRMLNodeNewMacro(vtkMRMLStenosisMeasurement3DParameterNode);

//----------------------------------------------------------------------------
vtkMRMLStenosisMeasurement3DParameterNode::vtkMRMLStenosisMeasurement3DParameterNode()
{
this->HideFromEditors = 1;
this->AddToSceneOn();

this->AddNodeReferenceRole(InputShapeNodeReferenceRole);
this->AddNodeReferenceRole(InputFiducialNodeReferenceRole);
this->AddNodeReferenceRole(InputSegmentationNodeReferenceRole);
this->AddNodeReferenceRole(OutputWallModelNodeReferenceRole);
this->AddNodeReferenceRole(OutputLumenModelNodeReferenceRole);
this->AddNodeReferenceRole(OutputTableNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLStenosisMeasurement3DParameterNode::~vtkMRMLStenosisMeasurement3DParameterNode() = default;

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetScene(vtkMRMLScene* scene)
{
Superclass::SetScene(scene);
if (scene && !this->GetName())
{
const std::string name = scene->GenerateUniqueName(this->GetNodeTagName());
this->SetName(name.c_str());
}
}


//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::PrintSelf(ostream& os, vtkIndent indent)
{
Superclass::PrintSelf(os,indent);
vtkMRMLPrintBeginMacro(os, indent);
vtkMRMLPrintStdStringMacro(InputSegmentID);
vtkMRMLPrintEndMacro();
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::ReadXMLAttributes(const char** atts)
{
// Read all MRML node attributes from two arrays of names and values
int disabledModify = this->StartModify();

Superclass::ReadXMLAttributes(atts);

vtkMRMLReadXMLBeginMacro(atts);
vtkMRMLReadXMLStringMacro(segmentID, InputSegmentID);
vtkMRMLReadXMLEndMacro();

this->EndModify(disabledModify);
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::WriteXML(ostream& of, int nIndent)
{
Superclass::WriteXML(of, nIndent);
vtkMRMLWriteXMLBeginMacro(of);
vtkMRMLWriteXMLStringMacro(segmentID, InputSegmentID);
vtkMRMLWriteXMLEndMacro();
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::CopyContent(vtkMRMLNode* anode, bool deepCopy/*=true*/)
{
MRMLNodeModifyBlocker blocker(this);
Superclass::CopyContent(anode, deepCopy);

vtkMRMLCopyBeginMacro(anode);
vtkMRMLCopyStringMacro(InputSegmentID);
vtkMRMLCopyEndMacro();
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetInputShapeNodeID(const char *nodeID)
{
this->SetNodeReferenceID(InputShapeNodeReferenceRole, nodeID);
}

//----------------------------------------------------------------------------
const char * vtkMRMLStenosisMeasurement3DParameterNode::GetInputShapeNodeID()
{
return this->GetNodeReferenceID(InputShapeNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLMarkupsShapeNode* vtkMRMLStenosisMeasurement3DParameterNode::GetInputShapeNode()
{
return vtkMRMLMarkupsShapeNode::SafeDownCast(this->GetNodeReference(InputShapeNodeReferenceRole));
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetInputFiducialNodeID(const char *nodeID)
{
this->SetNodeReferenceID(InputFiducialNodeReferenceRole, nodeID);
}

//----------------------------------------------------------------------------
const char * vtkMRMLStenosisMeasurement3DParameterNode::GetInputFiducialNodeID()
{
return this->GetNodeReferenceID(InputFiducialNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLMarkupsFiducialNode* vtkMRMLStenosisMeasurement3DParameterNode::GetInputFiducialNode()
{
return vtkMRMLMarkupsFiducialNode::SafeDownCast(this->GetNodeReference(InputFiducialNodeReferenceRole));
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetInputSegmentationNodeID(const char *nodeID)
{
this->SetNodeReferenceID(InputSegmentationNodeReferenceRole, nodeID);
}

//----------------------------------------------------------------------------
const char * vtkMRMLStenosisMeasurement3DParameterNode::GetInputSegmentationNodeID()
{
return this->GetNodeReferenceID(InputSegmentationNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLSegmentationNode* vtkMRMLStenosisMeasurement3DParameterNode::GetInputSegmentationNode()
{
return vtkMRMLSegmentationNode::SafeDownCast(this->GetNodeReference(InputSegmentationNodeReferenceRole));
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetOutputWallModelNodeID(const char *nodeID)
{
this->SetNodeReferenceID(OutputWallModelNodeReferenceRole, nodeID);
}

//----------------------------------------------------------------------------
const char * vtkMRMLStenosisMeasurement3DParameterNode::GetOutputWallModelNodeID()
{
return this->GetNodeReferenceID(OutputWallModelNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLModelNode* vtkMRMLStenosisMeasurement3DParameterNode::GetOutputWallModelNode()
{
return vtkMRMLModelNode::SafeDownCast(this->GetNodeReference(OutputWallModelNodeReferenceRole));
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetOutputLumenModelNodeID(const char *nodeID)
{
this->SetNodeReferenceID(OutputLumenModelNodeReferenceRole, nodeID);
}

//----------------------------------------------------------------------------
const char * vtkMRMLStenosisMeasurement3DParameterNode::GetOutputLumenModelNodeID()
{
return this->GetNodeReferenceID(OutputLumenModelNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLModelNode* vtkMRMLStenosisMeasurement3DParameterNode::GetOutputLumenModelNode()
{
return vtkMRMLModelNode::SafeDownCast(this->GetNodeReference(OutputLumenModelNodeReferenceRole));
}

//----------------------------------------------------------------------------
void vtkMRMLStenosisMeasurement3DParameterNode::SetOutputTableNodeID(const char *nodeID)
{
this->SetNodeReferenceID(OutputTableNodeReferenceRole, nodeID);
}

//----------------------------------------------------------------------------
const char * vtkMRMLStenosisMeasurement3DParameterNode::GetOutputTableNodeID()
{
return this->GetNodeReferenceID(OutputTableNodeReferenceRole);
}

//----------------------------------------------------------------------------
vtkMRMLTableNode* vtkMRMLStenosisMeasurement3DParameterNode::GetOutputTableNode()
{
return vtkMRMLTableNode::SafeDownCast(this->GetNodeReference(OutputTableNodeReferenceRole));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#ifndef __vtkmrmlstenosismeasurement3dparameternode_h_
#define __vtkmrmlstenosismeasurement3dparameternode_h_

#include "vtkMRML.h"
#include "vtkMRMLScene.h"
#include "vtkMRMLNode.h"
#include "vtkSlicerStenosisMeasurement3DModuleMRMLExport.h"
#include <vtkPolyData.h>

class vtkMRMLMarkupsShapeNode;
class vtkMRMLMarkupsFiducialNode;
class vtkMRMLSegmentationNode;
class vtkMRMLModelNode;
class vtkMRMLTableNode;

class VTK_SLICER_STENOSISMEASUREMENT3D_MODULE_MRML_EXPORT vtkMRMLStenosisMeasurement3DParameterNode :public vtkMRMLNode
{
public:
static vtkMRMLStenosisMeasurement3DParameterNode *New();
vtkTypeMacro(vtkMRMLStenosisMeasurement3DParameterNode, vtkMRMLNode);
void PrintSelf(ostream& os, vtkIndent indent) override;

vtkMRMLNode* CreateNodeInstance() override;
void SetScene(vtkMRMLScene * scene) override;

/// Set node attributes from XML attributes
void ReadXMLAttributes( const char** atts) override;

/// Write this node's information to a MRML file in XML format.
void WriteXML(ostream& of, int indent) override;

vtkMRMLCopyContentMacro(vtkMRMLStenosisMeasurement3DParameterNode);
const char* GetNodeTagName() override {return "StenosisMeasurement3DParameterSet";}

void SetInputShapeNodeID(const char *nodeID);
const char *GetInputShapeNodeID();
vtkMRMLMarkupsShapeNode* GetInputShapeNode();

void SetInputFiducialNodeID(const char *nodeID);
const char *GetInputFiducialNodeID();
vtkMRMLMarkupsFiducialNode* GetInputFiducialNode();

void SetInputSegmentationNodeID(const char *nodeID);
const char *GetInputSegmentationNodeID();
vtkMRMLSegmentationNode* GetInputSegmentationNode();

vtkSetStdStringFromCharMacro(InputSegmentID);
vtkGetCharFromStdStringMacro(InputSegmentID);

void SetOutputWallModelNodeID(const char *nodeID);
const char *GetOutputWallModelNodeID();
vtkMRMLModelNode* GetOutputWallModelNode();

void SetOutputLumenModelNodeID(const char *nodeID);
const char *GetOutputLumenModelNodeID();
vtkMRMLModelNode* GetOutputLumenModelNode();

void SetOutputTableNodeID(const char *nodeID);
const char *GetOutputTableNodeID();
vtkMRMLTableNode* GetOutputTableNode();

void SetOutputWallOpenPolyData(vtkPolyData * polydata) {this->OutputWallOpenPolyData = polydata;}
vtkPolyData* GetOutputWallOpenPolyData() {return this->OutputWallOpenPolyData;}

void SetOutputLumenOpenPolyData(vtkPolyData * polydata) {this->OutputLumenOpenPolyData = polydata;}
vtkPolyData* GetOutputLumenOpenPolyData() {return this->OutputLumenOpenPolyData;}

void SetOutputWallClosedPolyData(vtkPolyData * polydata) {this->OutputWallClosedPolyData = polydata;}
vtkPolyData* GetOutputWallClosedPolyData() {return this->OutputWallClosedPolyData;}

void SetOutputLumenClosedPolyData(vtkPolyData * polydata) {this->OutputLumenClosedPolyData = polydata;}
vtkPolyData* GetOutputLumenClosedPolyData() {return this->OutputLumenClosedPolyData;}

protected:
vtkMRMLStenosisMeasurement3DParameterNode();
~vtkMRMLStenosisMeasurement3DParameterNode() override;

vtkMRMLStenosisMeasurement3DParameterNode(const vtkMRMLStenosisMeasurement3DParameterNode&);
void operator=(const vtkMRMLStenosisMeasurement3DParameterNode&);

std::string InputSegmentID;
vtkSmartPointer<vtkPolyData> OutputWallOpenPolyData;
vtkSmartPointer<vtkPolyData> OutputLumenOpenPolyData;
vtkSmartPointer<vtkPolyData> OutputWallClosedPolyData;
vtkSmartPointer<vtkPolyData> OutputLumenClosedPolyData;
};

#endif // __vtkmrmlstenosismeasurement3dparameternode_h_
Loading