GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
itkCellForegroundExtraction.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #ifndef __itkCellForegroundExtraction_h
36 #define __itkCellForegroundExtraction_h
37 
38 #if defined( _MSC_VER )
39 #pragma warning ( disable : 4786 )
40 #endif
41 
42 #ifdef __BORLANDC__
43 #define ITK_LEAN_AND_MEAN
44 #endif
45 
46 #include "itkAffineTransform.h"
47 #include "itkImageToImageFilter.h"
48 #include "itkCastImageFilter.h"
49 #include "itkMedianImageFilter.h"
50 #include "itkAffineTransform.h"
51 #include "itkGrayscaleFillholeImageFilter.h"
52 #include "itkRecursiveGaussianImageFilter.h"
53 #include "itkRegionOfInterestImageFilter.h"
54 #include "itkDiscreteGaussianImageFilter.h"
55 #include "itkRescaleIntensityImageFilter.h"
56 #include "itkImageRegionIteratorWithIndex.h"
57 #include "itkResampleImageFilter.h"
58 #include "itkLinearInterpolateImageFunction.h"
60 #include "itkImageRegionIterator.h"
61 #include "itkImageRegion.h"
62 #include "itkRegion.h"
63 #include "itkIndex.h"
64 #include "itkSize.h"
65 
66 namespace itk
67 {
68 template< class TFeatureImage, class TInputImage, class TSegmentImage >
69 class CellForegroundExtraction:public ImageToImageFilter<
70  TFeatureImage, TSegmentImage >
71 {
72 public:
74  typedef ImageToImageFilter< TFeatureImage, TSegmentImage > Superclass;
75  typedef SmartPointer< Self > Pointer;
76  typedef SmartPointer< const Self > ConstPointer;
77 
78  itkStaticConstMacro (ImageDimension, unsigned int,
79  TFeatureImage::ImageDimension);
80 
82  itkNewMacro (Self);
83 
85  itkTypeMacro (CellForegroundExtraction, ImageToImageFilter);
86 
88  void PrintSelf(std::ostream & os, Indent indent) const;
89 
90  typedef TFeatureImage FeatureImageType;
91  typedef typename FeatureImageType::Pointer FeatureImagePointer;
92  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
93  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
94  typedef typename FeatureImageType::RegionType FeatureImageRegionType;
95  typedef typename FeatureImageType::SizeType FeatureImageSizeType;
96  typedef typename FeatureImageSizeType::SizeValueType FeatureImageSizeValueType;
97  typedef typename FeatureImageType::SpacingType FeatureImageSpacingType;
98  typedef typename FeatureImageType::IndexType FeatureImageIndexType;
99  typedef typename FeatureImageType::PointType FeatureImagePointType;
100 
101  typedef TInputImage ImageType;
102  typedef typename ImageType::Pointer ImagePointer;
103  typedef typename ImageType::ConstPointer ImageConstPointer;
104  typedef typename ImageType::PixelType ImagePixelType;
105  typedef typename ImageType::RegionType ImageRegionType;
106  typedef typename ImageType::SizeType ImageSizeType;
107  typedef typename ImageSizeType::SizeValueType ImageSizeValueType;
108  typedef typename ImageType::SpacingType ImageSpacingType;
109  typedef typename ImageType::IndexType ImageIndexType;
110  typedef typename ImageType::PointType ImagePointType;
111 
112  typedef TSegmentImage SegmentImageType;
113  typedef typename SegmentImageType::Pointer SegmentImagePointer;
114  typedef typename SegmentImageType::ConstPointer SegmentImageConstPointer;
115  typedef typename SegmentImageType::IndexType SegmentImageIndexType;
116  typedef typename SegmentImageType::PixelType SegmentImagePixelType;
117 
118  typedef RegionOfInterestImageFilter< FeatureImageType, FeatureImageType >
120  typedef typename ROIFilterType::Pointer ROIFilterPointer;
121 
122  typedef CastImageFilter< FeatureImageType, FeatureImageType > CastFilterType;
123  typedef typename CastFilterType::Pointer CastFilterPointer;
124 
125  typedef ResampleImageFilter< FeatureImageType, FeatureImageType > ResampleFeatureFilterType;
126  typedef typename ResampleFeatureFilterType::Pointer ResampleFeatureFilterPointer;
127 
128  typedef LinearInterpolateImageFunction< FeatureImageType > InterpolatorFeatureType;
129  typedef typename InterpolatorFeatureType::Pointer InterpolatorFeaturePointer;
130 
131  typedef ResampleImageFilter< ImageType, ImageType > ResampleFilterType;
132  typedef typename ResampleFilterType::Pointer ResampleFilterPointer;
133 
134  typedef LinearInterpolateImageFunction< ImageType > InterpolatorType;
135  typedef typename InterpolatorType::Pointer InterpolatorPointer;
136 
137  typedef AffineTransform< double, ImageDimension > TransformType;
138  typedef typename TransformType::Pointer TransformPointer;
139  typedef RescaleIntensityImageFilter< ImageType, ImageType >
141  typedef typename RescaleFilterType::Pointer RescaleFilterPointer;
142 
143  typedef GaussianProfileMatchingImageFilter< TFeatureImage,
144  TInputImage, TSegmentImage > GaussProfileFilterType;
146 
147  typedef ImageRegionConstIterator< FeatureImageType > FeatureConstIteratorType;
148  typedef ImageRegionIteratorWithIndex< FeatureImageType > FeatureIndexIteratorType;
149  typedef ImageRegionIterator< ImageType > IteratorType;
150  typedef ImageRegionIterator< SegmentImageType > SegmentIteratorType;
151  typedef ImageRegionIteratorWithIndex< ImageType > IndexIteratorType;
152 
153  itkGetConstMacro (SigmaForm, double);
154  itkSetMacro (SigmaForm, double);
155  itkGetConstMacro (ThresholdCellmin, double);
156  itkSetMacro (ThresholdCellmin, double);
157  itkGetConstMacro (ThresholdCellmax, double);
158  itkSetMacro (ThresholdCellmax, double);
159  itkGetConstMacro (ThresholdMembrane, double);
160  itkSetMacro (ThresholdMembrane, double);
161  itkGetConstMacro (ThresholdForm, double);
162  itkSetMacro (ThresholdForm, double);
163  itkGetConstMacro (LargestCellRadius, double);
164  itkSetMacro (LargestCellRadius, double);
165 
166  void SetSampling(float *sampling)
167  {
168  m_Sampling = sampling;
169  }
170 
172  {
173  return gauss;
174  }
175 
176 protected:
179 
182 
185 
186  void GenerateData();
187 
188  double m_SigmaForm;
191  double m_ThresholdMembrane; // Change to size threshold
194  float *m_Sampling;
196 private:
197  CellForegroundExtraction (Self &); // intentionally not implemented
198  void operator=(const Self &); // intentionally not implemented
199 };
200 } /* namespace itk */
201 
202 #include "itkCellForegroundExtraction.txx"
203 #endif
FeatureImageType::SizeType FeatureImageSizeType
LinearInterpolateImageFunction< ImageType > InterpolatorType
InterpolatorType::Pointer InterpolatorPointer
ImagePointer Resample(ImagePointer input, FeatureImageSpacingType spacing, FeatureImageSizeType size, FeatureImagePointType origin)
void operator=(const Self &)
CastImageFilter< FeatureImageType, FeatureImageType > CastFilterType
SegmentImageType::ConstPointer SegmentImageConstPointer
itkSetMacro(SigmaForm, double)
void PrintSelf(std::ostream &os, Indent indent) const
ImageRegionIterator< ImageType > IteratorType
itkGetConstMacro(SigmaForm, double)
FeatureImagePointer ResampleInput(FeatureImageConstPointer input, FeatureImageSpacingType spacing, FeatureImageSizeType size, FeatureImagePointType origin)
ResampleFeatureFilterType::Pointer ResampleFeatureFilterPointer
InterpolatorFeatureType::Pointer InterpolatorFeaturePointer
SegmentImageType::Pointer SegmentImagePointer
itkTypeMacro(CellForegroundExtraction, ImageToImageFilter)
RescaleIntensityImageFilter< ImageType, ImageType > RescaleFilterType
FeatureImageType::PointType FeatureImagePointType
FeatureImageType::Pointer FeatureImagePointer
AffineTransform< double, ImageDimension > TransformType
ImageToImageFilter< TFeatureImage, TSegmentImage > Superclass
FeatureImageType::ConstPointer FeatureImageConstPointer
GaussianProfileMatchingImageFilter< TFeatureImage, TInputImage, TSegmentImage > GaussProfileFilterType
FeatureImageType::IndexType FeatureImageIndexType
SmartPointer< const Self > ConstPointer
ResampleFilterType::Pointer ResampleFilterPointer
ImageRegionIterator< SegmentImageType > SegmentIteratorType
ImagePointer GetGaussCorrImage(void) const
RescaleFilterType::Pointer RescaleFilterPointer
FeatureImageSizeType::SizeValueType FeatureImageSizeValueType
ImageRegionIteratorWithIndex< FeatureImageType > FeatureIndexIteratorType
ImageRegionConstIterator< FeatureImageType > FeatureConstIteratorType
ResampleImageFilter< FeatureImageType, FeatureImageType > ResampleFeatureFilterType
ImageRegionIteratorWithIndex< ImageType > IndexIteratorType
FeatureImageType::RegionType FeatureImageRegionType
SegmentImageType::PixelType SegmentImagePixelType
itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension)
SegmentImageType::IndexType SegmentImageIndexType
ResampleImageFilter< ImageType, ImageType > ResampleFilterType
GaussProfileFilterType::Pointer GaussProfileFilterPointer
ImageSizeType::SizeValueType ImageSizeValueType
FeatureImageType::PixelType FeatureImagePixelType
LinearInterpolateImageFunction< FeatureImageType > InterpolatorFeatureType
RegionOfInterestImageFilter< FeatureImageType, FeatureImageType > ROIFilterType
FeatureImageType::SpacingType FeatureImageSpacingType