26 #ifndef __vtkSlicerSegmentationsModuleLogic_h 27 #define __vtkSlicerSegmentationsModuleLogic_h 31 #include "vtkSlicerSegmentationsModuleLogicExport.h" 36 class vtkCallbackCommand;
40 class vtkGeneralTransform;
56 void PrintSelf(ostream& os, vtkIndent indent)
override;
79 vtkMRMLSegmentationNode* LoadSegmentationFromFile(
const char* filename,
bool autoOpacities =
true,
const char* nodeName=
nullptr,
98 vtkMRMLVolumeNode* volumeNode,
bool shallowCopy =
true,
bool shiftImageDataExtentToZeroStart =
true);
110 static void GetAllLabelValues(vtkIntArray* labels, vtkImageData* labelmap);
138 static vtkSegment* GetSegmentForSegmentSubjectHierarchyItem(vtkIdType segmentShItemID,
vtkMRMLScene* scene);
152 const std::vector<std::string>& segmentIDs, vtkIdType folderItemId);
159 vtkStringArray* segmentIds, vtkIdType folderItemId);
181 static bool ExportSegmentsToLabelmapNode(
vtkMRMLSegmentationNode* segmentationNode,
const std::vector<std::string>& segmentIDs,
192 static bool ExportSegmentsToLabelmapNode(
vtkMRMLSegmentationNode* segmentationNode, vtkStringArray* segmentIDs,
227 vtkMRMLSegmentationNode* segmentationNode, std::string baseSegmentName=
"", std::string insertBeforeSegmentId=
"") ;
238 vtkGeneralTransform* labelmapToSegmentationTransform=
nullptr );
245 vtkMRMLSegmentationNode* segmentationNode, std::string terminologyContextName, std::string insertBeforeSegmentId=
"");
251 static bool ImportModelsToSegmentationNode(
261 static bool ExportSegmentsClosedSurfaceRepresentationToFiles(std::string destinationFolder,
263 std::string fileFormat =
"STL",
bool lps =
true,
double sizeScale = 1.0,
bool merge =
false);
273 vtkStringArray* segmentIds, vtkIntArray* labelValues);
286 static bool ExportSegmentsBinaryLabelmapRepresentationToFiles(std::string destinationFolder,
287 vtkMRMLSegmentationNode* segmentationNode, vtkStringArray* segmentIds =
nullptr, std::string extension =
"nrrd",
bool useCompression =
false,
296 static vtkDataObject* CreateRepresentationForOneSegment(
vtkSegmentation* segmentation, std::string segmentID, std::string representationName);
301 static bool ApplyParentTransformToOrientedImageData(
318 static bool GetTransformBetweenRepresentationAndSegmentation(
330 static bool GetSegmentRepresentation(
vtkMRMLSegmentationNode* segmentationNode, std::string segmentID, std::string representationName, vtkDataObject* segmentRepresentation,
bool applyParentTransform=
true);
354 std::string segmentID, vtkPolyData* polyData,
bool applyParentTransform =
true);
370 int mergeMode=MODE_REPLACE,
const int extent[6]=
nullptr,
bool minimumOfAllSegments=
false,
const std::vector<std::string>& segmentIdsToOverwrite={});
382 bool GetDefaultSurfaceSmoothingEnabled();
383 void SetDefaultSurfaceSmoothingEnabled(
bool enabled);
394 static const char* GetSegmentStatusAsHumanReadableString(
int segmentStatus);
396 static const char* GetSegmentStatusAsMachineReadableString(
int segmentStatus);
398 static int GetSegmentStatusFromMachineReadableString(std::string statusString);
401 static const char* GetStatusTagName();
404 static int GetSegmentStatus(
vtkSegment* segment);
408 static void SetSegmentStatus(
vtkSegment* segment,
int status);
419 std::vector<std::string>& segmentIDs,
int maskThreshold = 0.0,
bool includeInputSharedSegmentID =
false);
426 const std::vector<std::string>& segmentIDs={});
443 vtkStringArray* segmentIDs,
int extentComputationMode,
vtkOrientedImageData* mergedLabelmap_Reference, vtkIntArray* labelValues=
nullptr);
451 vtkStringArray* segmentIDs =
nullptr);
470 static void OnSubjectHierarchyUIDAdded(vtkObject* caller,
unsigned long eid,
void* clientData,
void* callData);
475 static bool ExportSegmentsClosedSurfaceRepresentationToStlFiles(std::string destinationFolder,
476 vtkMRMLSegmentationNode* segmentationNode,
const std::vector<std::string>& segmentIDs,
bool lps,
double sizeScale,
bool merge);
477 static bool ExportSegmentsClosedSurfaceRepresentationToObjFile(std::string destinationFolder,
478 vtkMRMLSegmentationNode* segmentationNode,
const std::vector<std::string>& segmentIDs,
bool lps,
double sizeScale);
483 static std::string GetSafeFileName(std::string originalName);
void PrintSelf(ostream &os, vtkIndent indent) override
static vtkSlicerModuleLogic * New()
The Usual vtk class functions.
This class encapsulates a segment that is part of a segmentation.
MRML node to represent a 3D surface model.
MRML node for representing a label map volume.
MRML node for segmentation storage on disk.
Image data containing orientation information.
A set of MRML Nodes that supports serialization and undo/redo.
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void RegisterNodes()
This class encapsulates a segmentation that can contain multiple segments and multiple representation...
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
Extent is computed as union of effective extent of all segments.
MRML node for representing a volume (image stack).
MRML node for representing a volume (image stack).
Abstract Superclass for all specific types of MRML nodes.
MRML node to represent discrete color information.
vtkCallbackCommand * SubjectHierarchyUIDCallbackCommand
Command handling subject hierarchy UID added events.
Extent of common geometry is used as extent.
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...