dox/Filtering/vtkIntensityTransferFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   BioImageXD
00004   Module:    $RCSfile: vtkPiecewiseFunction.h,v $
00005 
00006  Copyright (C) 2005  BioImageXD Project
00007  See CREDITS.txt for details
00008 
00009  This program is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  This program is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with this program; if not, write to the Free Software
00021  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023 
00024 =========================================================================*/
00025 
00035 #ifndef __vtkIntensityTransferFunction_h
00036 #define __vtkIntensityTransferFunction_h
00037 
00038 #include "vtkDataObject.h"
00039 #include "vtkPiecewiseFunction.h"
00040 
00041 class VTK_FILTERING_EXPORT vtkIntensityTransferFunction : public vtkPiecewiseFunction
00042 {
00043 public:
00044   static vtkIntensityTransferFunction *New();
00045   vtkTypeRevisionMacro(vtkIntensityTransferFunction,vtkPiecewiseFunction);
00046   void PrintSelf(ostream& os, vtkIndent indent);
00047 
00048   void Initialize();
00049   void DeepCopy( vtkDataObject *f );
00050   void ShallowCopy( vtkDataObject *f );
00051 
00053   int GetDataObjectType() {return VTK_PIECEWISE_FUNCTION;};
00054   
00056   int  GetSize();
00057 
00059   void RemoveAllPoints();
00060 
00061 
00065   int GetValue( int x );
00066 
00070   void ComputeFunction(void);
00071   
00073   int IsIdentical(void);
00074   
00076 
00078   int *GetDataPointer() { 
00079     if(this->GetMTime() > this->BuildTime.GetMTime()) this->ComputeFunction();
00081     
00082     return this->Function;
00083   }
00084 
00085 
00086 
00089   unsigned long GetMTime();
00090 
00093   double GetFirstNonZeroValue();
00094 
00096 
00097   vtkSetClampMacro(MinimumValue,int,0,255);
00098   vtkGetMacro(MinimumValue,int);
00099   // Description:
00100   // Set / Get the maximum value of the function
00101   vtkSetClampMacro(MaximumValue,int,0,255);
00102   vtkGetMacro(MaximumValue,int);
00103   // Description:
00104   // Set / Get the minimum threshold of the function
00105   vtkSetClampMacro(MinimumThreshold,int,0,255);
00106   vtkGetMacro(MinimumThreshold,int);
00108   
00110 
00111   vtkSetClampMacro(MaximumThreshold,int,0,255);     
00112   vtkGetMacro(MaximumThreshold,int);
00113   // Description:
00114   // Set / Get the processing threshold of the function, under which the function is identical
00115   vtkSetClampMacro(ProcessingThreshold,int,0,255);          
00116   vtkGetMacro(ProcessingThreshold,int);
00117   // Description:
00118   // Set / Get the contrast
00119   vtkSetClampMacro(Contrast,double,0.0,255.0);     
00120   vtkGetMacro(Contrast,double);
00121   // Description:
00122   // Set / Get the brightness
00123   vtkSetClampMacro(Brightness,int,-255,255);          
00124   vtkGetMacro(Brightness,double);
00125   // Description:
00126   // Set / Get the gamma
00127   vtkSetClampMacro(Gamma,double,0.0,255.0);
00128   vtkGetMacro(Gamma,double);      
00130   
00132 
00133   vtkSetClampMacro(SmoothStartGamma,double,0.0,255.0);
00134   vtkGetMacro(SmoothStartGamma,double);
00136 
00138 
00139   vtkSetClampMacro(SmoothEndGamma,double,0.0,255.0);
00140   vtkGetMacro(SmoothEndGamma,double);
00142 
00144 
00145   vtkSetClampMacro(SmoothStart,int,0,255);
00146   vtkGetMacro(SmoothStart,int);
00147   // Description:
00148   // Set / Get the smooth end
00149   vtkSetClampMacro(SmoothEnd,int,0,255);
00150   vtkGetMacro(SmoothEnd,int);
00152 
00158   vtkGetVector2Macro(GammaStart,int);
00159   // Description:
00160   // Get the point where the gamma curve ends
00161   vtkGetVector2Macro(GammaEnd,int);
00163   
00164   // Get the point where the gamma curve ends
00165   vtkGetVector2Macro(ReferencePoint,int);  
00166                      
00168 
00175   int GammaValue(int x0,int y0, int x1,int y1, int x, double gamma);
00176   // Description:
00177   // Returns the value of the function at slope point x
00178   // The function is of format:
00179   // y = contrast * x + b
00181 
00182 
00183   int f4(int x, int gx1,int gy1,int gx2,int gy2);
00184   void Reset(void);
00185 protected:
00186   vtkIntensityTransferFunction();
00187   ~vtkIntensityTransferFunction();
00188 
00189   // Size of the array used to store function points
00190   int   ArraySize;
00191 
00192   // Array of points ((X,Y) pairs)
00193   int *Function;
00194 
00195   // Min and max range of function point locations
00196   int FunctionRange[2];
00197 
00198   // Increases size of the function array. The array grows by a factor of 2
00199   // when the array limit has been reached.
00200   void IncreaseArraySize();
00201 
00203 
00204   void GetSlopeStart(int*x,int*y);
00205   // Description:
00206   // Returns the end point of the slope
00207   void GetSlopeEnd(int*x,int*y);
00209 
00211   void GetGammaPoints(int *gx0, int *gy0, int *gx1, int *gy1);
00212 
00213   int MinimumValue;
00214   int MaximumValue;
00215   int MinimumThreshold;
00216   int MaximumThreshold;
00217   int ProcessingThreshold;
00218   int Brightness;
00219   int SmoothStart;
00220   int SmoothEnd;
00221   double Gamma;
00222   double SmoothStartGamma;
00223   double SmoothEndGamma;
00224   double Contrast;
00225   int GammaStart[2];
00226   int GammaEnd[2];
00227   int ReferencePoint[2];
00228   vtkTimeStamp BuildTime;
00229 private:
00230   vtkIntensityTransferFunction(const vtkIntensityTransferFunction&);  // Not implemented.
00231   void operator=(const vtkIntensityTransferFunction&);  // Not implemented.
00232 };
00233 
00234 #endif
00235 

Generated on Fri Sep 7 17:44:02 2007 for VTK by  doxygen 1.5.3