Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

graphics/vtkEncodedGradientEstimator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkEncodedGradientEstimator.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00040 
00060 #ifndef __vtkEncodedGradientEstimator_h
00061 #define __vtkEncodedGradientEstimator_h
00062 
00063 #include "vtkObject.h"
00064 #include "vtkMultiThreader.h"
00065 #include "vtkImageData.h"
00066 #include "vtkDirectionEncoder.h"
00067 
00068 class VTK_EXPORT vtkEncodedGradientEstimator : public vtkObject
00069 {
00070 public:
00071   vtkTypeMacro(vtkEncodedGradientEstimator,vtkObject);
00072   void PrintSelf( ostream& os, vtkIndent index );
00073 
00075   vtkSetObjectMacro( Input, vtkImageData );
00076   vtkGetObjectMacro( Input, vtkImageData );
00077 
00079   vtkSetMacro( GradientMagnitudeScale, float );
00080   vtkGetMacro( GradientMagnitudeScale, float );
00081   vtkSetMacro( GradientMagnitudeBias, float );
00082   vtkGetMacro( GradientMagnitudeBias, float );
00083 
00086   vtkSetClampMacro( BoundsClip, int, 0, 1 );
00087   vtkGetMacro( BoundsClip, int );
00088   vtkBooleanMacro( BoundsClip, int );
00089   
00093   vtkSetVector6Macro( Bounds, int );
00094   vtkGetVectorMacro(  Bounds, int, 6 );
00095 
00097   void  Update( void );
00098 
00100   unsigned short  *GetEncodedNormals( void ); 
00101 
00103   int   GetEncodedNormalIndex( int xyz_index );
00104   int   GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00105 
00107   unsigned char *GetGradientMagnitudes(void);
00108 
00111   vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
00112   vtkGetMacro( NumberOfThreads, int );
00113 
00116   void SetDirectionEncoder( vtkDirectionEncoder *direnc );
00117   vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
00118 
00123   vtkSetMacro( ComputeGradientMagnitudes, int );
00124   vtkGetMacro( ComputeGradientMagnitudes, int );
00125   vtkBooleanMacro( ComputeGradientMagnitudes, int );
00126 
00131   vtkSetMacro( CylinderClip, int );
00132   vtkGetMacro( CylinderClip, int );
00133   vtkBooleanMacro( CylinderClip, int );
00134 
00136   vtkGetMacro( LastUpdateTimeInSeconds, float );
00137   vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
00138 
00139   vtkGetMacro( UseCylinderClip, int );
00140   int *GetCircleLimits() { return this->CircleLimits; };
00141 
00148   void SetZeroNormalThreshold( float v );
00149   vtkGetMacro( ZeroNormalThreshold, float );
00150 
00153   vtkSetClampMacro( ZeroPad, int, 0, 1 );
00154   vtkGetMacro( ZeroPad, int );
00155   vtkBooleanMacro( ZeroPad, int );
00156   
00157   
00158   // These variables should be protected but are being
00159   // made public to be accessible to the templated function.
00160   // We used to have the templated function as a friend, but
00161   // this does not work with all compilers
00162 
00163   // The input scalar data on which the normals are computed
00164   vtkImageData         *Input;
00165 
00166   // The encoded normals (2 bytes) and the size of the encoded normals
00167   unsigned short        *EncodedNormals;
00168   int                   EncodedNormalsSize[3];
00169 
00170   // The magnitude of the gradient array and the size of this array
00171   unsigned char         *GradientMagnitudes;
00172 
00173   // The time at which the normals were last built
00174   vtkTimeStamp          BuildTime;
00175 
00176   vtkGetVectorMacro( InputSize, int, 3 );
00177   vtkGetVectorMacro( InputAspect, float, 3 );
00178 
00179 protected:
00180   vtkEncodedGradientEstimator();
00181   ~vtkEncodedGradientEstimator();
00182   vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&) {};
00183   void operator=(const vtkEncodedGradientEstimator&) {};
00184 
00185   // The number of threads to use when encoding normals
00186   int                        NumberOfThreads;
00187 
00188   vtkMultiThreader           *Threader;
00189 
00190   vtkDirectionEncoder        *DirectionEncoder;
00191 
00192   virtual void               UpdateNormals( void ) = 0;
00193 
00194   float                      GradientMagnitudeScale;
00195   float                      GradientMagnitudeBias;
00196 
00197   float                      LastUpdateTimeInSeconds;
00198   float                      LastUpdateTimeInCPUSeconds;
00199 
00200   float                      ZeroNormalThreshold;
00201 
00202   int                        CylinderClip;
00203   int                        *CircleLimits;
00204   int                        CircleLimitsSize;
00205   int                        UseCylinderClip;
00206   void                       ComputeCircleLimits( int size );
00207   
00208   int                        BoundsClip;
00209   int                        Bounds[6];
00210 
00211   int                        InputSize[3];
00212   float                      InputAspect[3];
00213 
00214   int                        ComputeGradientMagnitudes;
00215   
00216   int                        ZeroPad;
00217   
00218 }; 
00219 
00220 
00221 #endif
00222 

Generated on Wed Nov 21 12:26:58 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001