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 std::vector<std::string>& segmentIDs, vtkIdType folderItemId);
159 vtkStringArray* segmentIds, vtkIdType folderItemId);
178 static bool ExportSegmentsToLabelmapNode(
vtkMRMLSegmentationNode* segmentationNode, std::vector<std::string>& segmentIDs,
189 static bool ExportSegmentsToLabelmapNode(
vtkMRMLSegmentationNode* segmentationNode, vtkStringArray* segmentIDs,
224 vtkMRMLSegmentationNode* segmentationNode, std::string baseSegmentName=
"", std::string insertBeforeSegmentId=
"") ;
235 vtkGeneralTransform* labelmapToSegmentationTransform=
nullptr );
242 vtkMRMLSegmentationNode* segmentationNode, std::string terminologyContextName, std::string insertBeforeSegmentId=
"");
248 static bool ImportModelsToSegmentationNode(
258 static bool ExportSegmentsClosedSurfaceRepresentationToFiles(std::string destinationFolder,
260 std::string fileFormat =
"STL",
bool lps =
true,
double sizeScale = 1.0,
bool merge =
false);
270 vtkStringArray* segmentIds, vtkIntArray* labelValues);
281 static bool ExportSegmentsBinaryLabelmapRepresentationToFiles(std::string destinationFolder,
282 vtkMRMLSegmentationNode* segmentationNode, vtkStringArray* segmentIds =
nullptr, std::string extension =
"nrrd",
bool useCompression =
false,
291 static vtkDataObject* CreateRepresentationForOneSegment(
vtkSegmentation* segmentation, std::string segmentID, std::string representationName);
296 static bool ApplyParentTransformToOrientedImageData(
313 static bool GetTransformBetweenRepresentationAndSegmentation(
325 static bool GetSegmentRepresentation(
vtkMRMLSegmentationNode* segmentationNode, std::string segmentID, std::string representationName, vtkDataObject* segmentRepresentation,
bool applyParentTransform=
true);
349 std::string segmentID, vtkPolyData* polyData,
bool applyParentTransform =
true);
365 int mergeMode=MODE_REPLACE,
const int extent[6]=
nullptr,
bool minimumOfAllSegments=
false, std::vector<std::string> segmentIdsToOverwrite={});
377 bool GetDefaultSurfaceSmoothingEnabled();
378 void SetDefaultSurfaceSmoothingEnabled(
bool enabled);
389 static const char* GetSegmentStatusAsHumanReadableString(
int segmentStatus);
391 static const char* GetSegmentStatusAsMachineReadableString(
int segmentStatus);
393 static int GetSegmentStatusFromMachineReadableString(std::string statusString);
396 static const char* GetStatusTagName();
398 static int GetSegmentStatus(
vtkSegment* segment);
400 static void SetSegmentStatus(
vtkSegment* segment,
int status);
411 std::vector<std::string>& segmentIDs,
int maskThreshold = 0.0,
bool includeInputSharedSegmentID =
false);
418 const std::vector<std::string>& segmentIDs={});
428 vtkStringArray* segmentIDs,
int extentComputationMode,
vtkOrientedImageData* mergedLabelmap_Reference);
441 static void OnSubjectHierarchyUIDAdded(vtkObject* caller,
unsigned long eid,
void* clientData,
void* callData);
446 static bool ExportSegmentsClosedSurfaceRepresentationToStlFiles(std::string destinationFolder,
447 vtkMRMLSegmentationNode* segmentationNode, std::vector<std::string>& segmentIDs,
bool lps,
double sizeScale,
bool merge);
448 static bool ExportSegmentsClosedSurfaceRepresentationToObjFile(std::string destinationFolder,
454 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...
Extent of common geometry is used as extent.
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
MRML node for representing a volume (image stack).
Extent is computed as union of effective extent of all segments.
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.
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...