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

Rendering/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 
00061 #ifndef __vtkEncodedGradientEstimator_h
00062 #define __vtkEncodedGradientEstimator_h
00063 
00064 #include "vtkObject.h"
00065 #include "vtkMultiThreader.h"
00066 #include "vtkImageData.h"
00067 #include "vtkDirectionEncoder.h"
00068 
00069 class VTK_RENDERING_EXPORT vtkEncodedGradientEstimator : public vtkObject
00070 {
00071 public:
00072   vtkTypeMacro(vtkEncodedGradientEstimator,vtkObject);
00073   void PrintSelf( ostream& os, vtkIndent index );
00074 
00076 
00077   vtkSetObjectMacro( Input, vtkImageData );
00078   vtkGetObjectMacro( Input, vtkImageData );
00080 
00082 
00083   vtkSetMacro( GradientMagnitudeScale, float );
00084   vtkGetMacro( GradientMagnitudeScale, float );
00085   vtkSetMacro( GradientMagnitudeBias, float );
00086   vtkGetMacro( GradientMagnitudeBias, float );
00088 
00090 
00092   vtkSetClampMacro( BoundsClip, int, 0, 1 );
00093   vtkGetMacro( BoundsClip, int );
00094   vtkBooleanMacro( BoundsClip, int );
00096   
00098 
00101   vtkSetVector6Macro( Bounds, int );
00102   vtkGetVectorMacro(  Bounds, int, 6 );
00104 
00106   void  Update( void );
00107 
00109   unsigned short  *GetEncodedNormals( void ); 
00110 
00112 
00113   int   GetEncodedNormalIndex( int xyz_index );
00114   int   GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00116 
00118   unsigned char *GetGradientMagnitudes(void);
00119 
00121 
00123   vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
00124   vtkGetMacro( NumberOfThreads, int );
00126 
00128 
00130   void SetDirectionEncoder( vtkDirectionEncoder *direnc );
00131   vtkGetObjectMacro( DirectionEncoder, vtkDirectionEncoder );
00133 
00135 
00139   vtkSetMacro( ComputeGradientMagnitudes, int );
00140   vtkGetMacro( ComputeGradientMagnitudes, int );
00141   vtkBooleanMacro( ComputeGradientMagnitudes, int );
00143 
00145 
00149   vtkSetMacro( CylinderClip, int );
00150   vtkGetMacro( CylinderClip, int );
00151   vtkBooleanMacro( CylinderClip, int );
00153 
00155 
00156   vtkGetMacro( LastUpdateTimeInSeconds, float );
00157   vtkGetMacro( LastUpdateTimeInCPUSeconds, float );
00159 
00160   vtkGetMacro( UseCylinderClip, int );
00161   int *GetCircleLimits() { return this->CircleLimits; };
00162 
00164 
00170   void SetZeroNormalThreshold( float v );
00171   vtkGetMacro( ZeroNormalThreshold, float );
00173 
00175 
00177   vtkSetClampMacro( ZeroPad, int, 0, 1 );
00178   vtkGetMacro( ZeroPad, int );
00179   vtkBooleanMacro( ZeroPad, int );
00181   
00182   
00183   // These variables should be protected but are being
00184   // made public to be accessible to the templated function.
00185   // We used to have the templated function as a friend, but
00186   // this does not work with all compilers
00187 
00188   // The input scalar data on which the normals are computed
00189   vtkImageData         *Input;
00190 
00191   // The encoded normals (2 bytes) and the size of the encoded normals
00192   unsigned short        *EncodedNormals;
00193   int                   EncodedNormalsSize[3];
00194 
00195   // The magnitude of the gradient array and the size of this array
00196   unsigned char         *GradientMagnitudes;
00197 
00198   // The time at which the normals were last built
00199   vtkTimeStamp          BuildTime;
00200 
00201 //BTX
00202   vtkGetVectorMacro( InputSize, int, 3 );
00203   vtkGetVectorMacro( InputAspect, float, 3 );
00204 //ETX
00205   
00206 protected:
00207   vtkEncodedGradientEstimator();
00208   ~vtkEncodedGradientEstimator();
00209 
00210   // The number of threads to use when encoding normals
00211   int                        NumberOfThreads;
00212 
00213   vtkMultiThreader           *Threader;
00214 
00215   vtkDirectionEncoder        *DirectionEncoder;
00216 
00217   virtual void               UpdateNormals( void ) = 0;
00218 
00219   float                      GradientMagnitudeScale;
00220   float                      GradientMagnitudeBias;
00221 
00222   float                      LastUpdateTimeInSeconds;
00223   float                      LastUpdateTimeInCPUSeconds;
00224 
00225   float                      ZeroNormalThreshold;
00226 
00227   int                        CylinderClip;
00228   int                        *CircleLimits;
00229   int                        CircleLimitsSize;
00230   int                        UseCylinderClip;
00231   void                       ComputeCircleLimits( int size );
00232   
00233   int                        BoundsClip;
00234   int                        Bounds[6];
00235 
00236   int                        InputSize[3];
00237   float                      InputAspect[3];
00238 
00239   int                        ComputeGradientMagnitudes;
00240   
00241   int                        ZeroPad;
00242   
00243 private:
00244   vtkEncodedGradientEstimator(const vtkEncodedGradientEstimator&);  // Not implemented.
00245   void operator=(const vtkEncodedGradientEstimator&);  // Not implemented.
00246 }; 
00247 
00248 
00249 #endif
00250 

Generated on Thu Mar 28 14:19:31 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001