#define CLITKEXTRACTPATIENTFILTER_H
#include "clitkFilterBase.h"
+#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
+#include "clitkSegmentationUtils.h"
namespace clitk {
*/
//--------------------------------------------------------------------
- template <class TInputImageType, class TOutputImageType>
+ template <class TInputImageType>
class ITK_EXPORT ExtractPatientFilter:
- public clitk::FilterBase,
- public itk::ImageToImageFilter<TInputImageType, TOutputImageType>
+ public virtual clitk::FilterBase,
+ public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
+ public itk::ImageToImageFilter<TInputImageType,
+ itk::Image<uchar, TInputImageType::ImageDimension> >
{
public:
/** Standard class typedefs. */
- typedef ExtractPatientFilter Self;
- typedef itk::ImageToImageFilter<TInputImageType, TOutputImageType> Superclass;
- typedef itk::SmartPointer<Self> Pointer;
- typedef itk::SmartPointer<const Self> ConstPointer;
+ typedef itk::Image<uchar, TInputImageType::ImageDimension> MaskImageType;
+ typedef ExtractPatientFilter Self;
+ typedef itk::ImageToImageFilter<TInputImageType, MaskImageType> Superclass;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
typedef typename InputImageType::SizeType InputImageSizeType;
typedef typename InputImageType::IndexType InputImageIndexType;
- typedef TOutputImageType OutputImageType;
- typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
- typedef typename OutputImageType::Pointer OutputImagePointer;
- typedef typename OutputImageType::RegionType OutputImageRegionType;
- typedef typename OutputImageType::PixelType OutputImagePixelType;
- typedef typename OutputImageType::SizeType OutputImageSizeType;
- typedef typename OutputImageType::IndexType OutputImageIndexType;
+ typedef typename MaskImageType::ConstPointer MaskImageConstPointer;
+ typedef typename MaskImageType::Pointer MaskImagePointer;
+ typedef typename MaskImageType::RegionType MaskImageRegionType;
+ typedef typename MaskImageType::PixelType MaskImagePixelType;
+ typedef typename MaskImageType::SizeType MaskImageSizeType;
+ typedef typename MaskImageType::IndexType MaskImageIndexType;
itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
typedef int InternalPixelType;
/** Connect inputs */
void SetInput(const TInputImageType * image);
-
- // Set all options at a time
- template<class ArgsInfoType>
- void SetArgsInfo(ArgsInfoType arg);
+ itkSetMacro(OutputPatientFilename, std::string);
+ itkGetMacro(OutputPatientFilename, std::string);
// Step 1
itkSetMacro(UpperThreshold, InputImagePixelType);
itkGetMacro(UpperThreshold, InputImagePixelType);
- GGO_DefineOption(upper, SetUpperThreshold, InputImagePixelType);
itkSetMacro(LowerThreshold, InputImagePixelType);
itkGetMacro(LowerThreshold, InputImagePixelType);
- itkSetMacro(UseLowerThreshold, bool);
+ itkSetMacro(UseLowerThreshold, bool);
+ itkGetMacro(PrimaryOpeningRadius, unsigned int);
+ itkSetMacro(PrimaryOpeningRadius, unsigned int);
itkGetConstMacro(UseLowerThreshold, bool);
itkBooleanMacro(UseLowerThreshold);
- GGO_DefineOption_WithTest(lower, SetLowerThreshold, InputImagePixelType, UseLowerThreshold);
// Step 2
itkSetMacro(DecomposeAndReconstructDuringFirstStep, bool);
itkGetConstMacro(DecomposeAndReconstructDuringFirstStep, bool);
itkBooleanMacro(DecomposeAndReconstructDuringFirstStep);
- GGO_DefineOption_Flag(erode1, SetDecomposeAndReconstructDuringFirstStep);
itkSetMacro(Radius1, InternalImageSizeType);
itkGetConstMacro(Radius1, InternalImageSizeType);
- GGO_DefineOption_Vector(radius1, SetRadius1, InternalImageSizeType, ImageDimension, true);
itkSetMacro(MaximumNumberOfLabels1, int);
itkGetConstMacro(MaximumNumberOfLabels1, int);
- GGO_DefineOption(max1, SetMaximumNumberOfLabels1, int);
itkSetMacro(NumberOfNewLabels1, int);
itkGetConstMacro(NumberOfNewLabels1, int);
- GGO_DefineOption(new1, SetNumberOfNewLabels1, int);
// Step 2
itkSetMacro(DecomposeAndReconstructDuringSecondStep, bool);
itkGetConstMacro(DecomposeAndReconstructDuringSecondStep, bool);
itkBooleanMacro(DecomposeAndReconstructDuringSecondStep);
- GGO_DefineOption_Flag(erode2, SetDecomposeAndReconstructDuringSecondStep);
itkSetMacro(Radius2, InternalImageSizeType);
itkGetConstMacro(Radius2, InternalImageSizeType);
- GGO_DefineOption_Vector(radius2, SetRadius2, InternalImageSizeType, ImageDimension, true)
itkSetMacro(MaximumNumberOfLabels2, int);
itkGetConstMacro(MaximumNumberOfLabels2, int);
- GGO_DefineOption(max2, SetMaximumNumberOfLabels2, int);
itkSetMacro(NumberOfNewLabels2, int);
itkGetConstMacro(NumberOfNewLabels2, int);
- GGO_DefineOption(new2, SetNumberOfNewLabels2, int);
// Step 3
itkSetMacro(FirstKeep, int);
itkGetConstMacro(FirstKeep, int);
- GGO_DefineOption(firstKeep, SetFirstKeep, int);
itkSetMacro(LastKeep, int);
itkGetConstMacro(LastKeep, int);
- GGO_DefineOption(lastKeep, SetLastKeep, int);
// Step 4
itkSetMacro(FinalOpenClose, bool);
itkGetConstMacro(FinalOpenClose, bool);
itkBooleanMacro(FinalOpenClose);
- GGO_DefineOption_Flag(openClose, SetFinalOpenClose);
// Step 4
itkSetMacro(AutoCrop, bool);
itkGetConstMacro(AutoCrop, bool);
itkBooleanMacro(AutoCrop);
- GGO_DefineOption_Flag(autoCrop, SetAutoCrop);
protected:
ExtractPatientFilter();
virtual ~ExtractPatientFilter() {}
- itkSetMacro(BackgroundValue, OutputImagePixelType);
- itkSetMacro(ForegroundValue, OutputImagePixelType);
- itkGetConstMacro(BackgroundValue, OutputImagePixelType);
- itkGetConstMacro(ForegroundValue, OutputImagePixelType);
- OutputImagePixelType m_BackgroundValue;
- OutputImagePixelType m_ForegroundValue;
-
+ itkSetMacro(BackgroundValue, MaskImagePixelType);
+ itkSetMacro(ForegroundValue, MaskImagePixelType);
+ itkGetConstMacro(BackgroundValue, MaskImagePixelType);
+ itkGetConstMacro(ForegroundValue, MaskImagePixelType);
+ MaskImagePixelType m_BackgroundValue;
+ MaskImagePixelType m_ForegroundValue;
+
+ std::string m_OutputPatientFilename;
InputImagePixelType m_UpperThreshold;
InputImagePixelType m_LowerThreshold;
bool m_UseLowerThreshold;
bool m_DecomposeAndReconstructDuringFirstStep;
bool m_DecomposeAndReconstructDuringSecondStep;
bool m_FinalOpenClose;
+ unsigned m_PrimaryOpeningRadius;
InternalImageSizeType m_Radius1;
InternalImageSizeType m_Radius2;
int m_MaximumNumberOfLabels1;
virtual void GenerateData();
InputImageConstPointer input;
- OutputImagePointer output;
+ MaskImagePointer output;
typename InternalImageType::Pointer working_image;
private: