vtkImageCurveRegion.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $RCSfile: vtkImageCurveRegion.h,v $
00010   Date:      $Date: 2006/04/13 19:29:02 $
00011   Version:   $Revision: 1.8 $
00012 
00013 =========================================================================auto=*/
00014 // .NAME vtkImageCurveRegion - Abstract Filter used in slicer to plot graphs
00015 // .SECTION Description
00016 // vtkImageCurveRegion
00017 //
00018 
00019 #ifndef __vtkImageCurveRegion_h
00020 #define __vtkImageCurveRegion_h
00021 
00022 #include "vtkImageSource.h"
00023 #include "vtkEMSegmentStep.h"
00024 
00025 
00026 // Copied from vtkImageGeneral.h
00027 // Abuse the type system.
00028 #define COERCE(x, type) (*((type *)(&(x))))
00029 // Some constants having to do with the way single
00030 // floats are represented on alphas and sparcs
00031 #define EMSEGMENT_MANTSIZE (23)
00032 #define EMSEGMENT_SIGNBIT (1 << 31)
00033 #define EMSEGMENT_EXPMASK (255 << EMSEGMENT_MANTSIZE)
00034 #define EMSEGMENT_MENTMASK ((~EMSEGMENT_EXPMASK)&(~EMSEGMENT_SIGNBIT))
00035 #define EMSEGMENT_PHANTOM_BIT (1 << EMSEGMENT_MANTSIZE)
00036 #define EMSEGMENT_EXPBIAS 127
00037 #define EMSEGMENT_SHIFTED_BIAS (EMSEGMENT_EXPBIAS << EMSEGMENT_MANTSIZE)
00038 #define EMSEGMENT_SHIFTED_BIAS_COMP ((~ EMSEGMENT_SHIFTED_BIAS) + 1)
00039 #define EMSEGMENT_ONE_OVER_2_PI 0.5/3.14159265358979
00040 #define EMSEGMENT_ONE_OVER_ROOT_2_PI sqrt(EMSEGMENT_ONE_OVER_2_PI)
00041 #define EMSEGMENT_MINUS_ONE_OVER_2_LOG_2 ((float) -.72134752)
00042 
00043 class VTK_EMSEGMENT_EXPORT vtkImageCurveRegion : public vtkImageSource
00044 {
00045 public:
00046   static vtkImageCurveRegion *New();
00047   vtkTypeMacro(vtkImageCurveRegion,vtkImageSource);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00050   void SetDimension(int value);
00051   vtkGetMacro(Dimension, int);
00052   vtkSetMacro(Xmin, float);
00053   vtkGetMacro(Xmin, float);
00054   vtkSetMacro(Xmax, float);
00055   vtkGetMacro(Xmax, float);
00056   // Description:
00057   // Define space between two points on the X-Axis to be calculated, e.g. 0.1, or define Xlength 
00058   vtkSetMacro(Xunit, float);
00059   vtkGetMacro(Xunit, float);
00060   vtkSetMacro(Xlength, int);
00061   vtkGetMacro(Xlength, int);
00062   // Description:
00063   // Ymin, Ymax, Yunit can only be set for Dimension = 2 (=> to calculate reange in second dimension, like Xmin Xmax for first dimension)
00064   vtkSetMacro(Ymin, float);
00065   vtkGetMacro(Ymin, float);
00066   vtkSetMacro(Ymax, float);
00067   vtkGetMacro(Ymax, float);
00068   // Description:
00069   // Define space between two points on the Y-Axis to be calculated, e.g. 0.1, or define Ylength 
00070   vtkSetMacro(Yunit, float);
00071   vtkGetMacro(Yunit, float);
00072 
00073   vtkSetMacro(Ylength, int);
00074   vtkGetMacro(Ylength, int);
00075 
00076   // Description:
00077   // Maximum and Minimum value of the function
00078   vtkGetMacro(FctMax, float);
00079   vtkGetMacro(FctMin, float);
00080 
00081   // Description:
00082   // Function to be executed. Currently implemented
00083   // 1 = Gausian
00084   // 2 = Log Gausian, where *min, *max, *unit correspond to the non log values (e.g. 0, 100, 1.0) 
00085   //     and Covariance and mean to log values  (3.65, 0.2)
00086   // 3 = Data will be read from file (FileName has to be defined)
00087   void SetFunction(int val);
00088   vtkGetMacro(Function, int);
00089   // Description:
00090   // Define first dimension before defining mean and covariance 
00091   // Also if you choose Function 2 Mean and Covirance correpsond to their log values , e.g. Mean = 50 => for function 2 enter 
00092   // Mean = log(50+1) !!
00093   void  SetMean(float value, int x) { if (this->Mean[x] != value) {this->Mean[x] = value; this->Modified();}} 
00094   float GetMean(int x) {return this->Mean[x];} 
00095 
00096   void  SetCovariance(float value, int y, int x) {if (this->Covariance[y][x] != value) {this->Covariance[y][x] = value; this->Modified();}} 
00097   float GetCovariance(int y, int x) {return this->Covariance[y][x];} 
00098 
00099   // Description:
00100   // Global probability, necessary if you have different curves with different weights 
00101   vtkSetMacro(Probability, float);
00102   vtkGetMacro(Probability, float);
00103 
00104   vtkGetStringMacro(FileName);
00105   vtkSetStringMacro(FileName);
00106 
00107 protected:
00108   vtkImageCurveRegion();
00109   void DeleteVariables();
00110   ~vtkImageCurveRegion() {this->DeleteVariables();};
00111 
00112   int Dimension;
00113   int Function;
00114   float Xmin;
00115   float Xmax;
00116   float Xunit;
00117   int Xlength;
00118 
00119   float Ymin;
00120   float Ymax;
00121   float Yunit;
00122   int Ylength;
00123 
00124   float FctMax;
00125   float FctMin;
00126 
00127   float* Mean;
00128   float** Covariance;
00129   float Probability;
00130 
00131   char* FileName;
00132 
00133   virtual void ExecuteInformation();
00134   virtual void ExecuteData(vtkDataObject *data);
00135   void ExecuteDataReadFile(vtkDataObject *output) ;
00136   void ExecuteDataGauss(vtkDataObject *output);
00137 private:
00138   vtkImageCurveRegion(const vtkImageCurveRegion&);  // Not implemented.
00139   void operator=(const vtkImageCurveRegion&);  // Not implemented.
00140 };
00141 
00142 
00143 #endif
00144 
00145   

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1