vtkImageEMGenericClass.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __vtkImageEMGenericClass_h
00021 #define __vtkImageEMGenericClass_h
00022
00023 #include "vtkEMSegment.h"
00024 #include <iostream>
00025 #include "vtkImageMultipleInputFilter.h"
00026 #include "vtkImageData.h"
00027 #include "vtkOStreamWrapper.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 enum classType {CLASS, SUPERCLASS};
00039
00040
00041
00042 class VTK_EMSEGMENT_EXPORT ProtocolMessages {
00043 public:
00044 int GetFlag() {return this->Flag;}
00045 char* GetMessages();
00046 void ResetParameters();
00047
00048 void AddMessage(const char* os);
00049
00050 ~ProtocolMessages() { this->DeleteMessage();}
00051 ProtocolMessages() {this->Message = new vtkOStrStreamWrapper; this->Flag = 0;}
00052
00053 vtkOStrStreamWrapper *Message;
00054 int Flag;
00055 private:
00056 void DeleteMessage();
00057 };
00058
00059
00060
00061 #define vtkEMAddMessageNoOutput(MessageNoOutputPtr, xout) \
00062 { \
00063 vtkOStreamWrapper::EndlType endl; \
00064 vtkOStreamWrapper::UseEndl(endl); \
00065 MessageNoOutputPtr->Message->rdbuf()->freeze(0); \
00066 (*MessageNoOutputPtr->Message) << xout << "\n"; \
00067 MessageNoOutputPtr->Flag = 1; \
00068 }
00069
00070
00071 #define vtkEMAddMessage(output,MessagePtr, x) \
00072 { \
00073 vtkEMAddMessageNoOutput(MessagePtr, x) \
00074 output << "MESSAGE: In " __FILE__ ", line " << __LINE__ << "\n" << x << "\n"; \
00075 }
00076
00077
00078 #define vtkEMJustAddErrorMessage(x) { \
00079 vtkEMAddMessageNoOutput((&this->ErrorMessage), x) ; \
00080 }
00081
00082 #define vtkEMJustAddErrorMessageSelf(x) { \
00083 vtkEMAddMessageNoOutput((self->GetErrorMessagePtr()), x) ; \
00084 }
00085
00086 #define vtkEMJustAddWarningMessage(x) { \
00087 vtkEMAddMessageNoOutput((&this->WarningMessage), x) ; \
00088 }
00089
00090 #define vtkEMJustAddWarningMessageSelf(x) { \
00091 vtkEMAddMessageNoOutput((self->GetWarningMessagePtr()), x) ; \
00092 }
00093
00094 #ifdef _WIN32
00095 #define vtkEMAddErrorMessage(x) {\
00096 vtkEMAddMessage(std::cerr, (&this->ErrorMessage), "- ERROR: " << x) ; \
00097 }
00098
00099 #else
00100 #define vtkEMAddErrorMessage(x) {\
00101 vtkEMAddMessage(std::cerr, (&this->ErrorMessage), "- ERROR: " << x) ; \
00102 }
00103 #endif
00104
00105 #ifdef _WIN32
00106 #define vtkEMAddErrorMessageSelf(x) {\
00107 vtkEMAddMessage(std::cerr,self->GetErrorMessagePtr(), "- ERROR: " << x); \
00108 }
00109 #else
00110 #define vtkEMAddErrorMessageSelf(x) {\
00111 vtkEMAddMessage(std::cerr,self->GetErrorMessagePtr(), "- ERROR: " << x); \
00112 }
00113 #endif
00114
00115 #define vtkEMAddWarningMessage(x) {\
00116 vtkEMAddMessage(std::cerr, (&this->WarningMessage), "- WARNING: " << x) ; \
00117 }
00118
00119 #define vtkEMAddWarningMessageSelf(x) {\
00120 vtkEMAddMessage(std::cerr,self->GetWarningMessagePtr(), "- WARNING: " << x); \
00121 }
00122
00123
00124
00125 class VTK_EMSEGMENT_EXPORT vtkImageEMGenericClass : public vtkImageMultipleInputFilter
00126 {
00127 public:
00128
00129
00130
00131 static vtkImageEMGenericClass *New();
00132 vtkTypeMacro(vtkImageEMGenericClass,vtkObject);
00133 void PrintSelf(ostream& os, vtkIndent indent);
00134
00135
00136
00137 vtkSetMacro(TissueProbability, double);
00138 vtkGetMacro(TissueProbability, double);
00139
00140
00141
00142
00143
00144 vtkSetMacro(ProbDataWeight,float);
00145 vtkGetMacro(ProbDataWeight,float);
00146
00147
00148
00149 vtkGetMacro(ProbDataScalarType,int);
00150
00151
00152
00153 vtkGetMacro(Label,short);
00154
00155
00156
00157
00158
00159
00160 void SetInputChannelWeights(float val, int x);
00161
00162 float* GetInputChannelWeights() {return this->InputChannelWeights;}
00163
00164
00165
00166
00167
00168
00169
00170 void SetNumInputImages(int number);
00171 vtkGetMacro(NumInputImages,int);
00172
00173
00174
00175 vtkGetVector3Macro(DataDim,int);
00176
00177
00178
00179 vtkGetVector3Macro(DataSpacing, float);
00180
00181
00182
00183
00184
00185
00186 vtkSetVector3Macro(SegmentationBoundaryMin,int);
00187 vtkSetVector3Macro(SegmentationBoundaryMax,int);
00188
00189 vtkGetVector3Macro(SegmentationBoundaryMin,int);
00190 vtkGetVector3Macro(SegmentationBoundaryMax,int);
00191
00192
00193
00194 void SetInputIndex(vtkImageData *, int ) {
00195 vtkErrorMacro(<< "In the new version SetInputIndex is disabled! Please look into vtkImageEM*Class.h to find out how to set the given parameters !");
00196 return;
00197 }
00198
00199
00200
00201
00202 char* GetErrorMessages() {return this->ErrorMessage.GetMessages(); }
00203 int GetErrorFlag() {return this->ErrorMessage.GetFlag();}
00204 void ResetErrorMessage() {this->ErrorMessage.ResetParameters();}
00205
00206
00207 ProtocolMessages* GetErrorMessagePtr(){return &this->ErrorMessage;}
00208
00209
00210 char* GetWarningMessages() {return this->WarningMessage.GetMessages(); }
00211 int GetWarningFlag() {return this->WarningMessage.GetFlag();}
00212 void ResetWarningMessage() {this->WarningMessage.ResetParameters();}
00213
00214
00215 ProtocolMessages* GetWarningMessagePtr(){return &this->WarningMessage;}
00216
00217
00218
00219
00220 vtkSetMacro(PrintWeights,int);
00221 vtkGetMacro(PrintWeights,int);
00222
00223 protected:
00224 vtkImageEMGenericClass();
00225 ~vtkImageEMGenericClass(){
00226 this->DeleteVariables();
00227 }
00228
00229
00230
00231
00232 void DeleteVariables();
00233
00234 void ThreadedExecute(vtkImageData **vtkNotUsed(inData),
00235 vtkImageData *vtkNotUsed(outData),
00236 int vtkNotUsed(outExt)[6], int vtkNotUsed(id)) {};
00237
00238
00239
00240
00241
00242
00243
00244 void ExecuteData(vtkDataObject *) ;
00245
00246 float ProbDataWeight;
00247 int ProbDataScalarType;
00248
00249 double TissueProbability;
00250 short Label;
00251 float* InputChannelWeights;
00252 int NumInputImages;
00253
00254 int DataDim[3];
00255 float DataSpacing[3];
00256 int SegmentationBoundaryMin[3];
00257 int SegmentationBoundaryMax[3];
00258
00259 ProtocolMessages ErrorMessage;
00260 ProtocolMessages WarningMessage;
00261
00262 int PrintWeights;
00263 private:
00264 vtkImageEMGenericClass(const vtkImageEMGenericClass&);
00265 void operator=(const vtkImageEMGenericClass&);
00266 };
00267
00268 #endif
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279