2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
4 #include "bbcreaMaracasVisuContourExtractDataBox.h"
5 #include "bbcreaMaracasVisuPackage.h"
7 #include "ContourExtractData.h"
12 namespace bbcreaMaracasVisu
15 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourExtractDataBox)
16 BBTK_BLACK_BOX_IMPLEMENTATION(ContourExtractDataBox,bbtk::AtomicBlackBox);
18 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
20 void ContourExtractDataBox::Process()
23 // THE MAIN PROCESSING METHOD BODY
24 // Here we simply set the input 'In' value to the output 'Out'
25 // And print out the output value
26 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
27 // void bbSet{Input|Output}NAME(const TYPE&)
28 // const TYPE& bbGet{Input|Output}NAME() const
30 // * NAME is the name of the input/output
31 // (the one provided in the attribute 'name' of the tag 'input')
32 // * TYPE is the C++ type of the input/output
33 // (the one provided in the attribute 'type' of the tag 'input')
34 // bbSetOutputOut( bbGetInputIn() );
35 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
37 ContourExtractData *contourextractdata = new ContourExtractData(true);
38 contourextractdata->SetImage( bbGetInputReferenceImage() );
39 if (bbGetInputRange().size()==2)
41 contourextractdata->SetScalarRange( bbGetInputRange()[0] , bbGetInputRange()[1] );
44 // _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
45 contourextractdata->InitVolumeStatistics();
46 std::vector<manualBaseModel*> lstManConMod;
47 lstManConMod.push_back( bbGetInputManualBaseModel() );
48 contourextractdata->SetLstManualContourModel( lstManConMod );
50 contourextractdata->ResetImageResult( bbGetInputZ() );
51 // for ( z=minZ ; z<=maxZ ; z++ )
53 contourextractdata->SetZtoBeAnalys( bbGetInputZ() );
54 contourextractdata->CalculateImageResult();
58 std::vector<double> LstValue;
59 std::vector<double> LstValuePosX;
60 std::vector<double> LstValuePosY;
61 std::vector<double> LstValuePosZ;
68 contourextractdata->GetValuesInsideCrown( &numberOfPixels,
78 int resultGrayRangeCount;
82 double resultStandarDeviation;
84 // resultSize=numberOfPixels;
86 if (bbGetInputRange().size()==2)
88 // Statistics of each slice.
89 contourextractdata->Statistics( &LstValue,
92 &resultGrayRangeCount,
97 &resultStandarDeviation);
98 bbSetOutputResultGrayRangeCount( (double)resultGrayRangeCount );
99 bbSetOutputResultSize( (double)resultSize );
100 bbSetOutputResultMin( resultMin );
101 bbSetOutputResultMax( resultMax );
102 bbSetOutputResultAverage( resultAverage );
103 bbSetOutputResultStandarDeviation( resultStandarDeviation );
106 vtkImageData *imageValues = contourextractdata->GetVtkImageValueResult();
107 vtkImageData *imageMask = contourextractdata->GetVtkImageMaskResult();
108 bbSetOutputValues( imageValues );
109 bbSetOutputMask( imageMask );
110 bbSetOutputNumberOfPixels( (double)numberOfPixels );
111 bbSetOutputLstValue( LstValue );
112 bbSetOutputLstValuePosX( LstValuePosX );
113 bbSetOutputLstValuePosX( LstValuePosY );
114 bbSetOutputLstValuePosX( LstValuePosZ );
116 // int vol_rCountRange;
118 // double vol_minValue;
119 // double vol_maxValue;
120 // double vol_average;
121 // double vol_standardeviation;
123 // _contourextractdata->GetVolumeStatistics(&vol_rCountRange, &vol_rsize,
124 // &vol_minValue, &vol_maxValue,
125 // &vol_average, &vol_standardeviation);
129 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
131 void ContourExtractDataBox::bbUserSetDefaultValues()
133 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
134 // Here we initialize the input 'In' to 0
135 bbSetInputManualBaseModel(NULL);
136 bbSetInputReferenceImage(NULL);
138 std::vector<double> rangeMinMax;
139 rangeMinMax.push_back(-10000);
140 rangeMinMax.push_back(10000);
141 bbSetInputRange(rangeMinMax);
142 bbSetOutputMask(NULL);
143 bbSetOutputValues(NULL);
145 bbSetOutputResultGrayRangeCount( -1 );
146 bbSetOutputResultSize( -1 );
147 bbSetOutputResultMin( -1 );
148 bbSetOutputResultMax( -1 );
149 bbSetOutputResultAverage( -1 );
150 bbSetOutputResultStandarDeviation( -1 );
155 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
157 void ContourExtractDataBox::bbUserInitializeProcessing()
159 // THE INITIALIZATION METHOD BODY :
161 // but this is where you should allocate the internal/output pointers
166 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
168 void ContourExtractDataBox::bbUserFinalizeProcessing()
170 // THE FINALIZATION METHOD BODY :
172 // but this is where you should desallocate the internal/output pointers
176 }// EO namespace bbcreaMaracasVisu