vtkImageMeanIntensityNormalization.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003 (c) Copyright 2003 Massachusetts Institute of Technology (MIT) All Rights Reserved.
00004 
00005 This software ("3D Slicer") is provided by The Brigham and Women's 
00006 Hospital, Inc. on behalf of the copyright holders and contributors.
00007 Permission is hereby granted, without payment, to copy, modify, display 
00008 and distribute this software and its documentation, if any, for  
00009 research purposes only, provided that (1) the above copyright notice and 
00010 the following four paragraphs appear on all copies of this software, and 
00011 (2) that source code to any modifications to this software be made 
00012 publicly available under terms no more restrictive than those in this 
00013 License Agreement. Use of this software constitutes acceptance of these 
00014 terms and conditions.
00015 
00016 3D Slicer Software has not been reviewed or approved by the Food and 
00017 Drug Administration, and is for non-clinical, IRB-approved Research Use 
00018 Only.  In no event shall data or images generated through the use of 3D 
00019 Slicer Software be used in the provision of patient care.
00020 
00021 IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE TO 
00022 ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 
00023 DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, 
00024 EVEN IF THE COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE BEEN ADVISED OF THE 
00025 POSSIBILITY OF SUCH DAMAGE.
00026 
00027 THE COPYRIGHT HOLDERS AND CONTRIBUTORS SPECIFICALLY DISCLAIM ANY EXPRESS 
00028 OR IMPLIED WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00029 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND 
00030 NON-INFRINGEMENT.
00031 
00032 THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
00033 IS." THE COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE NO OBLIGATION TO 
00034 PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00035 
00036 
00037 =========================================================================auto=*/
00038 // .NAME vtkImageMeanIntensityNormalization
00039 
00040 #ifndef __vtkImageMeanIntensityNormalization_h
00041 #define __vtkImageMeanIntensityNormalization_h
00042 
00043 
00044 #include "vtkImageToImageFilter.h"
00045 #include "vtkImageAccumulate.h"
00046 #include "vtkIntensityNormalizationFilter.h"
00047 
00048 #define INTENSITY_NORM_UNDEFINED 0
00049 #define INTENSITY_NORM_MEAN_MRI 1
00050 
00051 class VTK_IntensityNormalizationFilter_EXPORT vtkImageMeanIntensityNormalization : public vtkImageToImageFilter
00052 {
00053   public:
00054   static vtkImageMeanIntensityNormalization *New();
00055   vtkTypeMacro(vtkImageMeanIntensityNormalization,vtkImageToImageFilter);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00058   vtkSetMacro(NormValue,double);
00059   vtkGetMacro(NormValue,double);
00060 
00061   vtkSetMacro(NormType,int);
00062   vtkGetMacro(NormType,int);
00063   void SetTypeToNormMeanMRI() {this->NormType = INTENSITY_NORM_MEAN_MRI; }
00064 
00065   // Description:
00066   // Define initial width for smoothing the intensity histogram, e.g. 2 => smoothing width = numober of voxels / 2;
00067   vtkSetMacro(InitialHistogramSmoothingWidth,int);
00068   vtkGetMacro(InitialHistogramSmoothingWidth,int);
00069 
00070   // Description:
00071   // Define maximum width for smoothing the intensity histogram, e.g. 5 => smoothing width = numober of voxels / 5;
00072   vtkSetMacro(MaxHistogramSmoothingWidth,int);
00073   vtkGetMacro(MaxHistogramSmoothingWidth,int);
00074 
00075   // Description:
00076   // Define percentage of voxels that should be included in intensity normalization
00077   // Traditionally the value is 0.99
00078   // However, some T2 have a large hump at the end so it should be set to 95%
00079   vtkSetMacro(RelativeMaxVoxelNum,float);
00080   vtkGetMacro(RelativeMaxVoxelNum,float);
00081 
00082   vtkSetMacro(PrintInfo,int);
00083   vtkGetMacro(PrintInfo,int);
00084 
00085 protected:
00086 
00087   vtkImageMeanIntensityNormalization();
00088   vtkImageMeanIntensityNormalization(const vtkImageMeanIntensityNormalization&) {};
00089   ~vtkImageMeanIntensityNormalization();
00090 
00091   void operator=(const vtkImageMeanIntensityNormalization&) {};
00092   
00093   // When it works on parallel machines use : 
00094   //  void ThreadedExecute(vtkImageData *inData, vtkImageData *outData,int outExt[6], int id);
00095   // If you do not want to have it multi threaded 
00096   void ExecuteData(vtkDataObject *);
00097   void ExecuteInformation(){this->vtkImageToImageFilter::ExecuteInformation();};
00098   void ExecuteInformation(vtkImageData *inData,vtkImageData *outData);
00099   void ComputeInputUpdateExtent(int inExt[6], int outExt[6]);
00100 
00101   // Core function
00102   void MeanMRI(vtkImageData *Input, vtkImageData *Output);
00103   // Functions called from MeanMRI
00104   int* InitializeHistogram(vtkImageAccumulate *HIST, vtkImageData *Input, int &HistMin, int &HistMax);
00105   int  DetermineFilterMax(int *HIST_Ptr, const int HIST_Length, const int FilterNumMaxVoxels);
00106   int  DetermineFilterMin(const int* HIST_PTR, const int HIST_Length);
00107   // Functions needed to determine lower bound of filter (DetermineFilterMin)
00108   int  DetermineFirstValey(const int *SmoothHistogram,const int SmoothHistogramLength);
00109   void SmoothHistogram(const int* Input , const int InputLength, const int SmoothWidth, int &MaxIndex, int* Output);
00110 
00111   double NormValue; 
00112   int NormType; 
00113   int InitialHistogramSmoothingWidth;
00114   int MaxHistogramSmoothingWidth;
00115   float RelativeMaxVoxelNum;
00116   int PrintInfo;
00117 
00118 };
00119 #endif
00120 
00121 
00122 
00123  
00124 
00125 
00126 
00127 
00128 
00129 
00130 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1