Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkEncodedGradientEstimator.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkEncodedGradientEstimator_h
00012 #define __mitkEncodedGradientEstimator_h
00013 
00014 #include "mitkObject.h"
00015 #include "mitkRCPtr.h"
00016 #include "mitkVolume.h"
00017 #include "mitkDirectionEncoder.h"
00018 
00024 class MITK_VISUALIZATION_API mitkEncodedGradientEstimator : public mitkObject
00025 {
00026 public:
00027     //operations
00028     MITK_TYPE(mitkEncodedGradientEstimator,mitkObject)
00029         
00030     
00031 
00032 
00033 
00034 
00035     void SetInput(mitkVolume *pInVolume);
00036 
00042     mitkVolume* GetInput(){return this->m_Input;}
00043     
00048     void SetGradientMagnitudeScale(float fGMS){this->m_GradientMagnitudeScale = fGMS;};
00049 
00054     float GetGradientMagnitudeScale(){return this->m_GradientMagnitudeScale;};
00055 
00060     void SetGradientMagnitudeBias(float fGMB){this->m_GradientMagnitudeBias = fGMB;};
00061 
00066     float GetGradientMagnitudeBias(){return this->m_GradientMagnitudeBias;};    
00067     
00073     virtual void SetBoundsClip(int nBoundsClip){
00074         if (this->m_BoundsClip != (nBoundsClip < 0 ? 0 : (nBoundsClip > 1 ? 1 : nBoundsClip))) 
00075         { 
00076             this->m_BoundsClip = (nBoundsClip < 0 ? 0 : (nBoundsClip > 1 ? 1 : nBoundsClip)); 
00077         } 
00078     };  
00079 
00084     virtual int GetBoundsClipMinValue(){return 0;};
00085 
00090     virtual int GetBoundsClipMaxValue(){return 1;};
00091 
00096     virtual int GetBoundsClip(){return this->m_BoundsClip;};
00097 
00101     virtual void SetBoundsClipOn(){this->SetBoundsClip(1);};
00102 
00106     virtual void SetBoundsClipOff(){this->SetBoundsClip(0);};
00107     
00118     virtual void SetBounds(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
00119 
00130     virtual void SetBounds(int arg[6]);
00131 
00142     virtual void GetBounds(int &arg1, int &arg2, int &arg3, int &arg4, int &arg5, int &arg6);
00143 
00154     void GetBounds(int arg[6]);
00155 
00161     int* GetBounds();
00162     
00170     void SetComputeGradientMagnitudes(int nCGM){this->m_ComputeGradientMagnitudes = nCGM;};
00171 
00176     int GetComputeGradientMagnitudes(){return this->m_ComputeGradientMagnitudes;};
00177 
00183     virtual void SetComputeGradientMagnitudesOn(){this->SetComputeGradientMagnitudes(1);};
00184 
00190     virtual void SetComputeGradientMagnitudesOff(){this->SetComputeGradientMagnitudes(0);}; 
00191     
00198     void SetCylinderClip(int nCC){this->m_CylinderClip = nCC;};
00199 
00204     int GetCylinderClip(){return this->m_CylinderClip;};
00205 
00211     virtual void SetCylinderClipOn(){this->SetCylinderClip(1);};
00212 
00218     virtual void SetCylinderClipOff(){this->SetCylinderClip(0);};   
00219     
00224     int GetUseCylinderClip(){return this->m_UseCylinderClip;};
00225 
00230     int *GetCircleLimits() { return this->m_CircleLimits; };
00231     
00241     void SetZeroNormalThreshold( float v );
00242 
00247     float GetZeroNormalThreshold(){return this->m_ZeroNormalThreshold; };
00248     
00254     virtual void SetZeroPad(int nZeroPad){
00255         if (this->m_ZeroPad != (nZeroPad < 0 ? 0 : (nZeroPad > 1 ? 1 : nZeroPad))) 
00256         { 
00257             this->m_ZeroPad = (nZeroPad < 0 ? 0 : (nZeroPad > 1 ? 1 : nZeroPad)); 
00258         } 
00259     };  
00260 
00265     virtual int GetZeroPadMinValue(){return 0;};
00266 
00271     virtual int GetZeroPadMaxValue(){return 1;};
00272 
00277     virtual int GetZeroPad(){return this->m_ZeroPad;}; 
00278 
00282     virtual void SetZeroPadOn(){this->SetZeroPad(1);};
00283 
00287     virtual void SetZeroPadOff(){this->SetZeroPad(0);}; 
00288     
00292     void  Update();
00293     
00303     unsigned short  *GetEncodedNormals(); 
00304 
00309     mitkVolume* GetEncodedNormalsVol();
00310     
00311     
00312     int   GetEncodedNormalIndex( int xyz_index );
00313 
00314 
00315     int   GetEncodedNormalIndex( int x_index, int y_index, int z_index );
00316     
00326     unsigned char *GetGradientMagnitudes();
00327 
00332     mitkVolume* GetGradientMagnitudesVol();
00333     
00339     void SetDirectionEncoder( mitkDirectionEncoder *direnc );
00340 
00346     mitkDirectionEncoder* GetDirectionEncoder(){return this->m_DirectionEncoder;}
00347     
00348     //attributes:
00349     // These variables should be protected but are being
00350     // made public to be accessible to the templated function.
00351     // We used to have the templated function as a friend, but
00352     // this does not work with all compilers
00353     
00354     // The input scalar data on which the normals are computed
00355     mitkRCPtr<mitkVolume> m_Input;
00356     
00357     // The encoded normals (2 bytes) and the size of the encoded normals
00358     unsigned short        *m_EncodedNormals;
00359     int                   m_EncodedNormalsSize[3];
00360     
00361     // The magnitude of the gradient array and the size of this array
00362     unsigned char         *m_GradientMagnitudes;
00363 
00364     // in case of out-of-core data
00365     mitkVolume *m_EncodedNormalsVol;
00366     mitkVolume *m_GradientMagnitudesVol;
00367     
00368     int *GetInputSize(){return this->m_InputSize;};
00369     void GetInputSize(int data[3]){for (int i = 0; i < 3; i++) data[i] = this->m_InputSize[i];};
00370     float *GetInputAspect(){return this->m_InputAspect;};
00371     void GetInputAspect(float data[3]){for (int i = 0; i < 3; i++) data[i] = this->m_InputAspect[i];};
00372     
00373     
00374 protected:
00375     mitkEncodedGradientEstimator();
00376     virtual ~mitkEncodedGradientEstimator();    
00377     
00378     //Attributes:
00379     
00380     mitkRCPtr<mitkDirectionEncoder> m_DirectionEncoder;
00381     
00382     float                      m_GradientMagnitudeScale;
00383     float                      m_GradientMagnitudeBias;
00384     
00385     float                      m_ZeroNormalThreshold;
00386     
00387     int                        m_CylinderClip;
00388     int                        *m_CircleLimits;
00389     int                        m_CircleLimitsSize;
00390     int                        m_UseCylinderClip;
00391     
00392     int                        m_BoundsClip;
00393     int                        m_Bounds[6];
00394     
00395     int                        m_InputSize[3];
00396     float                      m_InputAspect[3];
00397     
00398     int                        m_ComputeGradientMagnitudes;
00399     
00400     int                        m_ZeroPad;   
00401 
00402     bool                       m_EnalbleOoC;
00403     //operations:
00404     virtual void               _updateNormals( void ) = 0;
00405     void                       _computeCircleLimits( int size );
00406 
00407 private:
00408     mitkEncodedGradientEstimator(const mitkEncodedGradientEstimator&);
00409     void operator=(const mitkEncodedGradientEstimator&);
00410 };
00411 
00412  
00413 //#define DEFINED_mitkEncodedGradientEstimator
00414  
00415 
00416 
00417 #endif
00418 
00419 /*=========================================================================
00420 
00421   Program:   Visualization Toolkit
00422   Module:    $RCSfile$
00423   Language:  C++
00424   Date:      $Date: 2006-08-02 17:05:13 +0800 (ÐÇÆÚÈý, 02 °ËÔÂ 2006) $
00425   Version:   $Revision: 35 $
00426 
00427 
00428 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00429 All rights reserved.
00430 
00431 Redistribution and use in source and binary forms, with or without
00432 modification, are permitted provided that the following conditions are met:
00433 
00434  * Redistributions of source code must retain the above copyright notice,
00435    this list of conditions and the following disclaimer.
00436 
00437  * Redistributions in binary form must reproduce the above copyright notice,
00438    this list of conditions and the following disclaimer in the documentation
00439    and/or other materials provided with the distribution.
00440 
00441  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00442    of any contributors may be used to endorse or promote products derived
00443    from this software without specific prior written permission.
00444 
00445  * Modified source versions must be plainly marked as such, and must not be
00446    misrepresented as being the original software.
00447 
00448 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00449 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00450 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00451 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00452 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00453 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00454 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00455 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00456 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00457 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00458 
00459 =========================================================================*/ 
00460 

Generated on Tue Feb 25 15:00:36 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3