-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkEMSegmentMRMLManager.h
687 lines (518 loc) · 27.1 KB
/
vtkEMSegmentMRMLManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
#ifndef __vtkEMSegmentMRMLManager_h
#define __vtkEMSegmentMRMLManager_h
#include "vtkEMSegment.h"
#include <vtkSetGet.h>
#define ERROR_NODE_VTKID 0
class vtkMRMLEMSGlobalParametersNode;
class vtkMRMLEMSTemplateNode;
class vtkMRMLEMSAtlasNode;
class vtkMRMLEMSTreeNode;
class vtkMRMLEMSTreeParametersNode;
class vtkMRMLEMSTreeParametersParentNode;
class vtkMRMLEMSWorkingDataNode;
#if defined(Slicer_USE_PYTHONQT)
class vtkMRMLColorLogic;
#endif
class vtkMRMLLabelMapVolumeNode;
class vtkMRMLScalarVolumeNode;
class vtkMRMLVolumeNode;
class vtkMRMLEMSVolumeCollectionNode;
class vtkMRMLStorableNode;
// need enum values
#include "vtkMRMLEMSTreeParametersLeafNode.h"
class vtkMRMLScene;
#include <string>
#include <map>
#include <vector>
class VTK_EMSEGMENT_EXPORT vtkEMSegmentMRMLManager :
public vtkObject
{
public:
static vtkEMSegmentMRMLManager *New();
vtkTypeMacro(vtkEMSegmentMRMLManager,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
// Prints out important info about the current template / task
void PrintInfo(ostream& os);
void PrintInfo();
#if defined(Slicer_USE_PYTHONQT)
// if you do not do it then you get errors when wrapping Tcl code in Slicer 3
//BTX
virtual void SetColorLogic(vtkMRMLColorLogic* colorLogic);
vtkGetObjectMacro(ColorLogic, vtkMRMLColorLogic);
//ETX
#endif
// Get/Set the current mrml scene
vtkSetObjectMacro(MRMLScene, vtkMRMLScene);
vtkGetObjectMacro(MRMLScene, vtkMRMLScene);
// Get/Set MRML node storing parameter values
virtual int SetNodeWithCheck(vtkMRMLEMSTemplateNode*);
vtkGetObjectMacro(Node, vtkMRMLEMSTemplateNode);
// this will be be passed along by the logic node
virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event,
void *callData );
int CreateTemplateFile();
//
// functions for getting and setting the current template builder
// node (i.e. the set of parameters to edit and use)
//
virtual int GetNumberOfParameterSets();
virtual const char* GetNthParameterSetName(int n);
virtual void SetNthParameterName(int n, const char* newName);
// this functions creates a full set of MRML nodes for this module,
// populates the nodes with default values, adds the nodes to the
// MRML scene.
virtual void CreateAndObserveNewParameterSet();
int SetLoadedParameterSetIndex(int i);
int SetLoadedParameterSetIndex(vtkMRMLEMSTemplateNode* tNode);
virtual int CheckEMSTemplateVolumeNodes(vtkMRMLEMSTemplateNode* emsTemplateNode);
//
// functions for manipulating the tree structure
//
virtual vtkIdType GetTreeRootNodeID();
virtual int GetTreeNodeIsLeaf(vtkIdType nodeID);
virtual int GetTreeNodeNumberOfChildren(vtkIdType nodeID);
virtual vtkIdType GetTreeNodeChildNodeID(vtkIdType parentNodeID,
int childIndex);
virtual vtkIdType GetTreeNodeParentNodeID(vtkIdType childNodeID);
virtual void SetTreeNodeParentNodeID(vtkIdType childNodeID,
vtkIdType newParentNodeID);
virtual vtkIdType AddTreeNode(vtkIdType parentNodeID);
virtual void RemoveTreeNode(vtkIdType removedNodeID);
//
// functions for accessing tree-node parameters
//
// Step 1
int GetTreeNodeIntensityLabel(vtkIdType nodeID);
const char* GetTreeNodeIntensityLabelName(vtkIdType nodeID);
virtual void SetTreeNodeIntensityLabel(vtkIdType nodeID, int label);
virtual void GetTreeNodeColor(vtkIdType nodeID, double rgb[3]);
virtual void SetTreeNodeColor(vtkIdType nodeID, double rgb[3]);
virtual const char* GetTreeNodeName(vtkIdType id);
virtual void SetTreeNodeName(vtkIdType id, const char* label);
virtual void SetTreeNodeNameToIntensityLabelName(vtkIdType nodeID);
virtual void SetLeafNodeNamesToIntensityLabelNameRecursively(vtkIdType nodeID);
virtual void SetEntireLeafNodeNamesToIntensityLabelName();
// Step 2 see below (volume access)
// Step 3 does not depend on tree structure
// Step 4
//BTX
enum
{
DistributionSpecificationManual =
vtkMRMLEMSTreeParametersLeafNode::DistributionSpecificationManual,
DistributionSpecificationManuallySample =
vtkMRMLEMSTreeParametersLeafNode::DistributionSpecificationManuallySample,
DistributionSpecificationAutoSample =
vtkMRMLEMSTreeParametersLeafNode::DistributionSpecificationAutoSample
};
//ETX
virtual int GetTreeNodeDistributionSpecificationMethod(vtkIdType nodeID);
virtual void SetTreeNodeDistributionSpecificationMethod(vtkIdType nodeID,
int method);
virtual void ChangeTreeNodeDistributionsFromManualSamplingToManual();
virtual void SetTreeNodeDistributionLogMean(vtkIdType nodeID, int volumeNumber, double value);
virtual double GetTreeNodeDistributionLogMeanWithCorrection(vtkIdType nodeID, int volumeNumber);
virtual void SetTreeNodeDistributionLogCovariance(vtkIdType nodeID,
int rowIndex,
int columnIndex,
double value);
virtual double GetTreeNodeDistributionLogCovarianceWithCorrection(vtkIdType nodeID, int rowIndex, int columnIndex);
virtual bool IsTreeNodeDistributionLogCovarianceWithCorrectionInvertableAndSemiDefinite(vtkIdType nodeID);
virtual int GetTreeNodeDistributionNumberOfSamples(vtkIdType nodeID);
// send RAS coordinates
virtual int AddTreeNodeDistributionSamplePoint(vtkIdType nodeID,
double xyz[3]);
virtual void RemoveTreeNodeDistributionSamplePoint(vtkIdType nodeID,
int samplePointNumber);
virtual void RemoveAllTreeNodeDistributionSamplePoints(vtkIdType nodeID);
virtual void GetTreeNodeDistributionSamplePoint(vtkIdType nodeID,
int tupleNumber,
double xyz[3]);
virtual double
GetTreeNodeDistributionSampleIntensityValue(vtkIdType nodeID,
int tupleNumber,
vtkIdType volumeID);
virtual void UpdateIntensityDistributions();
// Step 5
virtual int GetTreeNodeInteractionMatrices2DFlag(vtkIdType nodeID);
virtual void SetTreeNodeInteractionMatrices2DFlag(vtkIdType nodeID, int value);
virtual int GetTreeNodePrintWeight(vtkIdType nodeID);
virtual void SetTreeNodePrintWeight(vtkIdType nodeID, int shouldPrint);
virtual void PrintWeightOnForEntireTree();
virtual int GetTreeNodePrintQuality(vtkIdType nodeID);
virtual void SetTreeNodePrintQuality(vtkIdType nodeID, int shouldPrint);
virtual int GetTreeNodePrintFrequency(vtkIdType nodeID);
virtual void SetTreeNodePrintFrequency(vtkIdType nodeID,
int shouldPrint);
virtual int GetTreeNodePrintLabelMap(vtkIdType nodeID);
virtual void SetTreeNodePrintLabelMap(vtkIdType nodeID, int shouldPrint);
virtual int GetTreeNodePrintEMLabelMapConvergence(vtkIdType nodeID);
virtual void SetTreeNodePrintEMLabelMapConvergence(vtkIdType nodeID,
int shouldPrint);
virtual int GetTreeNodePrintEMWeightsConvergence(vtkIdType nodeID);
virtual void SetTreeNodePrintEMWeightsConvergence(vtkIdType nodeID,
int shouldPrint);
virtual int GetTreeNodePrintMFALabelMapConvergence(vtkIdType nodeID);
virtual void SetTreeNodePrintMFALabelMapConvergence(vtkIdType nodeID,
int shouldPrint);
virtual int GetTreeNodePrintMFAWeightsConvergence(vtkIdType nodeID);
virtual void SetTreeNodePrintMFAWeightsConvergence(vtkIdType nodeID,
int shouldPrint);
virtual int GetTreeNodeGenerateBackgroundProbability(vtkIdType nodeID);
virtual void SetTreeNodeGenerateBackgroundProbability(vtkIdType nodeID,
int value);
virtual int GetTreeNodeExcludeFromIncompleteEStep(vtkIdType nodeID);
virtual void SetTreeNodeExcludeFromIncompleteEStep(vtkIdType nodeID,
int shouldExclude);
virtual double GetTreeNodeAlpha(vtkIdType nodeID);
virtual void SetTreeNodeAlpha(vtkIdType nodeID, double value);
virtual int GetTreeNodePrintBias(vtkIdType nodeID);
virtual void SetTreeNodePrintBias(vtkIdType nodeID, int shouldPrint);
virtual int GetTreeNodeBiasCalculationMaxIterations(vtkIdType nodeID);
virtual void SetTreeNodeBiasCalculationMaxIterations(vtkIdType nodeID,
int value);
virtual int GetTreeNodeSmoothingKernelWidth(vtkIdType nodeID);
virtual void SetTreeNodeSmoothingKernelWidth(vtkIdType nodeID,
int value);
virtual double GetTreeNodeSmoothingKernelSigma(vtkIdType nodeID);
virtual void SetTreeNodeSmoothingKernelSigma(vtkIdType nodeID,
double value);
virtual double GetBiasCorrectionType(vtkIdType nodeID);
virtual void SetBiasCorrectionType(vtkIdType nodeID,
double value);
virtual double GetTreeNodeClassProbability(vtkIdType nodeID);
virtual void SetTreeNodeClassProbability(vtkIdType nodeID, double value);
virtual double GetTreeNodeChildrenSumClassProbability(vtkIdType nodeID);
virtual double GetTreeNodeSpatialPriorWeight(vtkIdType nodeID);
virtual void SetTreeNodeSpatialPriorWeight(vtkIdType nodeID, double value);
virtual double GetTreeNodeInputChannelWeight(vtkIdType nodeID,
int volumeNumber);
virtual void SetTreeNodeInputChannelWeight(vtkIdType nodeID,
int volumeNumber,
double value);
virtual int GetTreeNodeStoppingConditionEMType(vtkIdType nodeID);
virtual void SetTreeNodeStoppingConditionEMType(vtkIdType nodeID,
int conditionType);
virtual double GetTreeNodeStoppingConditionEMValue(vtkIdType nodeID);
virtual void SetTreeNodeStoppingConditionEMValue(vtkIdType nodeID,
double value);
virtual int GetTreeNodeStoppingConditionEMIterations(vtkIdType nodeID);
virtual void SetTreeNodeStoppingConditionEMIterations(vtkIdType nodeID,
int iterations);
//BTX
enum
{
StoppingConditionIterations = 0,
StoppingConditionLabelMapMeasure = 1,
StoppingConditionWeightsMeasure = 2
};
//ETX
virtual int GetTreeNodeStoppingConditionMFAType(vtkIdType nodeID);
virtual void SetTreeNodeStoppingConditionMFAType(vtkIdType nodeID,
int conditionType);
virtual double GetTreeNodeStoppingConditionMFAValue(vtkIdType nodeID);
virtual void SetTreeNodeStoppingConditionMFAValue(vtkIdType nodeID,
double value);
virtual int GetTreeNodeStoppingConditionMFAIterations(vtkIdType nodeID);
virtual void SetTreeNodeStoppingConditionMFAIterations(vtkIdType nodeID,
int iterations);
// Step 6 does not depend on tree structure
// Step 7 does not depend on tree structure
//
// functions for checking tree node parameters
//
virtual vtkIdType GetTreeNodeFirstIDWithChildProbabilityError();
//
// functions for accessing volumes
//
virtual int GetVolumeNumberOfChoices();
virtual vtkIdType GetVolumeNthID(int n);
virtual const char* GetVolumeName(vtkIdType volumeID);
// spatial prior volumes
virtual vtkIdType GetTreeNodeSpatialPriorVolumeID(vtkIdType nodeID);
virtual void SetTreeNodeSpatialPriorVolumeID(vtkIdType nodeID, vtkIdType volumeID);
vtkMRMLVolumeNode* GetAlignedSpatialPriorFromTreeNodeID(vtkIdType nodeID);
virtual void SetAlignedSpatialPrior(vtkIdType nodeID, vtkIdType volumeID);
virtual vtkIdType GetTreeNodeSubParcellationVolumeID(vtkIdType nodeID);
virtual void SetTreeNodeSubParcellationVolumeID(vtkIdType nodeID, vtkIdType volumeID);
vtkMRMLVolumeNode* GetAlignedSubParcellationFromTreeNodeID(vtkIdType nodeID);
virtual void SetEnableSubParcellation(int state);
virtual int GetEnableSubParcellation();
virtual void SetMinimumIslandSize(int value);
virtual int GetMinimumIslandSize();
virtual int GetIsland2DFlag() ;
virtual void SetIsland2DFlag(int) ;
// target volumes
virtual int GetTargetNumberOfSelectedVolumes();
// index in [0, #selected volumes)
virtual vtkIdType GetTargetSelectedVolumeNthID(int n);
virtual const char* GetTargetSelectedVolumeNthMRMLID(int n);
//BTX
virtual void
ResetTargetSelectedVolumes(const std::vector<vtkIdType>& volumeID);
//ETX
virtual void AddTargetSelectedVolume(vtkIdType volumeID);
virtual void AddTargetSelectedVolumeByMRMLID(char* mrmlID);
virtual void RemoveTargetSelectedVolume(vtkIdType volumeID);
virtual void RemoveTargetSelectedVolumeIndex(vtkIdType imageIndex);
virtual void MoveNthTargetSelectedVolume(int fromIndex,
int toIndex);
virtual void MoveTargetSelectedVolume(vtkIdType volumeID,
int toIndex);
virtual bool DoTargetAndAtlasDataTypesMatch( vtkMRMLEMSVolumeCollectionNode* targetNode, vtkMRMLEMSAtlasNode* atlasNode );
//
// registration parameters
//
//BTX
enum
{
RegistrationTest = -1,
RegistrationOff = 0,
RegistrationFast = 1,
RegistrationSlow = 2
};
//ETX
virtual int GetRegistrationAffineType();
virtual void SetRegistrationAffineType(int affineType);
int GetRegistrationTypeFromString(const char* type);
virtual int GetRegistrationDeformableType();
virtual void SetRegistrationDeformableType(int deformableType);
virtual int GetEnableTargetToTargetRegistration();
virtual void SetEnableTargetToTargetRegistration(int enable);
virtual const char* GetColorNodeID();
virtual void SetColorNodeID(const char* colormap);
//BTX
enum
{
InterpolationLinear = 0,
InterpolationNearestNeighbor = 1,
// !!!todo!!! there is no corresponding definition in the algorithm!
InterpolationCubic = 2
};
//ETX
virtual int GetRegistrationInterpolationType();
virtual void SetRegistrationInterpolationType(int interpolationType);
int GetInterpolationTypeFromString(const char* type);
//BTX
enum
{
CMTK = 0,
BRAINS = 1,
PLASTIMATCH = 2,
DEMONS = 3,
DRAMMS = 4,
ANTS = 5,
};
//ETX
virtual int GetRegistrationPackageType();
virtual void SetRegistrationPackageType(int packageType);
int GetPackageTypeFromString(const char* type);
virtual vtkIdType GetRegistrationAtlasVolumeID();
virtual void SetRegistrationAtlasVolumeID(vtkIdType volumeID);
virtual vtkIdType GetRegistrationAtlasVolumeID(vtkIdType inputID);
virtual void SetRegistrationAtlasVolumeID(vtkIdType inputID, vtkIdType volumeID);
virtual bool ExistRegistrationAtlasVolumeKey(vtkIdType inputID);
virtual void SetTargetSelectedVolumeNthID(int n, vtkIdType newVolumeID);
virtual void SetTargetSelectedVolumeNthMRMLID(int n, const char* mrmlID);
virtual double GetTreeNodeDistributionMeanWithCorrection(vtkIdType nodeID, int volumeNumber);
virtual void SetTreeNodeDistributionMeanWithCorrection(vtkIdType nodeID, int volumeNumber, double value);
virtual void ResetTreeNodeDistributionLogMeanCorrection(vtkIdType nodeID);
void ResetTreeNodeDistributionLogCovarianceCorrection(vtkIdType nodeID);
// Resets the LogCovariance of the entire tree
void ResetLogCovarianceCorrectionOfAllNodes();
void SetTreeNodeDistributionLogCovarianceWithCorrection(vtkIdType nodeID, int rowIndex, int columnIndex, double value);
//
// save parameters
//
virtual const char* GetSaveWorkingDirectory();
virtual void SetSaveWorkingDirectory(const char* directory);
virtual const char* GetSaveTemplateFilename();
virtual void SetSaveTemplateFilename(const char* file);
virtual int GetSaveTemplateAfterSegmentation();
virtual void SetSaveTemplateAfterSegmentation(int shouldSave);
virtual int GetSaveIntermediateResults();
virtual void SetSaveIntermediateResults(int shouldSaveResults);
virtual int GetSaveSurfaceModels();
virtual void SetSaveSurfaceModels(int shouldSaveModels);
virtual const char* GetOutputVolumeMRMLID();
virtual void SetOutputVolumeMRMLID(const char* mrmlID);
//
// miscellaneous
//
virtual int GetEnableMultithreading();
virtual void SetEnableMultithreading(int isEnabled);
virtual int GetUpdateIntermediateData();
virtual void SetUpdateIntermediateData(int shouldUpdate);
virtual int GetAtlasNumberOfTrainingSamples();
virtual void ComputeAtlasNumberOfTrainingSamples();
virtual void GetSegmentationBoundaryMin(int minPoint[3]);
virtual void SetSegmentationBoundaryMin(int minPoint[3]);
virtual void GetSegmentationBoundaryMax(int maxPoint[3]);
virtual void SetSegmentationBoundaryMax(int maxPoint[3]);
// If flag is set then only checks the template for nodes that are essential for GUI
// If flag = 0 then checks the existence of all nodes essential for processing
virtual int CheckTemplateMRMLStructure(vtkMRMLEMSTemplateNode *emsTemp, int guiFlag);
// checks the entire tree if all nodes are defined so we can start segmentation
virtual int CheckMRMLNodeStructureForProcessing()
{
return this->CheckTemplateMRMLStructure(this->Node,0);
}
// adds important nodes to the tree that are needed for using the gui
virtual void CompleteTemplateMRMLStructureForGUI(vtkMRMLEMSTemplateNode *emsTemp);
//
// this functions registers all of the MRML nodes needed by this
// class with the MRML scene
//
virtual void RegisterMRMLNodesWithScene();
// Return if we have a global parameters node
virtual int HasGlobalParametersNode();
virtual void PrintTree();
virtual void PrintTree(vtkIdType rootID, vtkIndent indent);
virtual void PrintVolumeInfo( vtkMRMLScene* mrmlScene );
//
// convenience functions for managing MRML nodes
//
virtual vtkMRMLEMSVolumeCollectionNode* GetTargetInputNode();
virtual vtkMRMLEMSAtlasNode* GetAtlasInputNode();
virtual vtkMRMLEMSVolumeCollectionNode* GetSubParcellationInputNode();
virtual vtkMRMLEMSAtlasNode* GetAtlasAlignedNode();
virtual vtkMRMLLabelMapVolumeNode* GetOutputVolumeNode();
virtual vtkMRMLEMSGlobalParametersNode* GetGlobalParametersNode();
virtual vtkMRMLEMSTreeNode* GetTreeRootNode();
virtual vtkMRMLEMSTreeNode* GetTreeNode(vtkIdType);
virtual bool TreeNodeExists(vtkIdType nodeID);
virtual vtkMRMLEMSTreeParametersLeafNode* GetTreeParametersLeafNode(vtkIdType);
virtual vtkMRMLVolumeNode* GetVolumeNode(vtkIdType);
virtual vtkMRMLEMSWorkingDataNode* GetWorkingDataNode();
virtual vtkMRMLEMSVolumeCollectionNode* CloneTargetNode(vtkMRMLEMSVolumeCollectionNode* target, const char* name)
{
return CloneVolumeCollectionNode(target, name);
}
virtual vtkMRMLEMSVolumeCollectionNode* CloneSubParcellationNode(vtkMRMLEMSVolumeCollectionNode* target, const char* name)
{
return CloneVolumeCollectionNode(target, name);
}
virtual vtkMRMLEMSAtlasNode* CloneAtlasNode(vtkMRMLEMSAtlasNode* target, const char* name);
virtual void SynchronizeTargetNode(vtkMRMLEMSVolumeCollectionNode* templateNode, vtkMRMLEMSVolumeCollectionNode* changingNode, const char* name)
{
this->SynchronizeVolumeCollectionNode(templateNode, changingNode, name);
}
virtual void SynchronizeSubParcellationNode(vtkMRMLEMSVolumeCollectionNode* templateNode, vtkMRMLEMSVolumeCollectionNode* changingNode, const char* name)
{
this->SynchronizeVolumeCollectionNode(templateNode, changingNode, name);
}
virtual void SynchronizeAtlasNode(vtkMRMLEMSAtlasNode* templateNode, vtkMRMLEMSAtlasNode* changingNode, const char* name);
//
// convenience functions for managing ID mapping (mrml id <-> vtkIdType)
//
virtual const char* MapVTKNodeIDToMRMLNodeID(vtkIdType vtkID);
virtual vtkIdType MapMRMLNodeIDToVTKNodeID(const char* MRMLNodeID);
//BTX
virtual void GetListOfTreeNodeIDs(vtkIdType rootNodeID,
std::vector<vtkIdType>& list);
//ETX
virtual const char* GetTclTaskFilename();
virtual void SetTclTaskFilename(const char* fileName);
//BTX
std::string TurnDefaultMRMLFileIntoTaskName(const char* fileName);
std::string TurnDefaultTclFileIntoPreprocessingName(const char* fileName);
//ETX
virtual int IDMapContainsMRMLNodeID(const char* MRMLNodeID);
virtual int IDMapContainsVTKNodeID(vtkIdType id);
void SetTreeNodeDistributionLogCovarianceOffDiagonal(vtkIdType nodeID, double value);
virtual void CopyEMRelatedNodesToMRMLScene(vtkMRMLScene* newScene);
virtual void RemoveLegacyNodes();
// Needed for Tcl - if you set it as "" then it is interpreted as an id
void SetStorageNodeToNULL(vtkMRMLStorableNode* sNode) ;
//BTX
void ImportMRMLFile(const char *mrmlFile, std::string errMSG);
//ETX
// interface to ImportMRMLFile without the errMSG
void ImportMRMLFile(const char *mrmlFile);
// referenceNode is only needed to create a volume node of the same type - Returns VTKNodeID
vtkMRMLScalarVolumeNode* CreateVolumeScalarNode(vtkMRMLScalarVolumeNode* referenceNode , const char *name);
vtkIdType CreateVolumeScalarNodeVolumeID(vtkMRMLScalarVolumeNode* referenceNode , const char *name);
// Removes all nodes and files but the segmentation and the input images
void RemoveTaskRelatedNodesFromScene();
private:
vtkEMSegmentMRMLManager();
~vtkEMSegmentMRMLManager();
vtkEMSegmentMRMLManager(const vtkEMSegmentMRMLManager&);
void operator=(const vtkEMSegmentMRMLManager&);
// Should only be used within this structure as it does not check
virtual void SetNode(vtkMRMLEMSTemplateNode*);
virtual vtkIdType AddNewTreeNode();
virtual vtkIdType GetNewVTKNodeID();
virtual void RemoveTreeNodeParametersNodes(vtkIdType nodeID);
virtual void PropogateAdditionOfSelectedTargetImage();
virtual void PropogateRemovalOfSelectedTargetImage(int index);
virtual void PropogateMovementOfSelectedTargetImage(int fromIndex,
int toIndex);
// Update intensity statistics for a particular tissue type.
virtual void UpdateIntensityDistributionFromSample(vtkIdType nodeID);
//BTX
std::string TurnDefaultFileIntoName(std::string taskName);
//ETX
virtual void IDMapInsertPair(vtkIdType vtkID,
const char* MRMLNodeID);
virtual void IDMapRemovePair(vtkIdType vtkID);
virtual void IDMapRemovePair(const char* MRMLNodeID);
virtual void UpdateMapsFromMRML();
virtual int GetTargetVolumeIndex(vtkIdType vtkID);
#if defined(Slicer_USE_PYTHONQT)
// The color logic used to retrieve the default color node for the
// color map
vtkMRMLColorLogic* ColorLogic;
#endif
// the current mrml scene
vtkMRMLScene* MRMLScene;
//
// parameters node that is currently under consideration
//
vtkMRMLEMSTemplateNode* Node;
// global switch to hide EM segment parameters from MRML tree
// editors
bool HideNodesFromEditors;
//
// The api of this class exposes vtkIdType ids for tree nodes and
// volumes. This essentially hides the mrml ids from client code and
// insulates the client from changes in the slicer mrml id
// mechanism.
//
vtkIdType NextVTKNodeID;
//BTX
typedef std::map<vtkIdType, std::string> VTKToMRMLMapType;
VTKToMRMLMapType VTKNodeIDToMRMLNodeIDMap;
typedef std::map<std::string, vtkIdType> MRMLToVTKMapType;
MRMLToVTKMapType MRMLNodeIDToVTKNodeIDMap;
std::vector<std::vector<double> > GetTreeNodeDistributionLogCovariance(vtkIdType nodeID);
std::vector<std::vector<double> > GetTreeNodeDistributionLogCovarianceCorrection(vtkIdType nodeID);
// Should Only be used in this function - bc only set through gui which calls DistributionMeanWithCorrection
virtual double GetTreeNodeDistributionLogMeanCorrection(vtkIdType nodeID,
int volumeNumber);
virtual void SetTreeNodeDistributionLogMeanCorrection(vtkIdType nodeID,
int volumeNumber,
double value);
// Functions should only call the corrected ones
virtual double GetTreeNodeDistributionLogMean(vtkIdType nodeID, int volumeNumber);
// Should Only be used in this function - bc only set through gui which calls DistributionLogCovarianceWithCorrection
virtual double GetTreeNodeDistributionLogCovarianceCorrection(vtkIdType nodeID, int rowIndex, int columnIndex);
// virtual void SetTreeNodeDistributionLogCovarianceCorrection(vtkIdType nodeID, std::vector<std::vector<double> > cov);
virtual double GetTreeNodeDistributionLogCovariance(vtkIdType nodeID,
int rowIndex,
int columnIndex);
int TreeNodeDistributionLogCovarianceCorrectionEnabled(vtkIdType nodeID);
// Reset the correction of the node as well as subtree
void ResetLogCovarianceCorrectionsOfAllNodes(vtkIdType rootID);
void TurnFromParentToLeafNode(vtkMRMLEMSTreeNode* treeNode) ;
virtual vtkMRMLEMSVolumeCollectionNode* CloneVolumeCollectionNode(vtkMRMLEMSVolumeCollectionNode* target, const char* name);
virtual void SynchronizeVolumeCollectionNode(vtkMRMLEMSVolumeCollectionNode* templateNode, vtkMRMLEMSVolumeCollectionNode* changingNode, const char* name);
//ETX
virtual void SetOutputVolumeID(vtkIdType volumeID);
void PrintWeightOnForTree(vtkIdType rootID);
void RemoveWorkingNodeFromScene();
// Removes all volumes linked to a collection node with the associated storage and display nodes from the scene
// Furthermore, removes the files associated with the storage node
void RemoveVolumesAndFilesOfCollectionNodes(vtkMRMLEMSVolumeCollectionNode* collectionNode, int flag);
};
#endif