#include "clitkFilterBase.h"
#include "clitkDecomposeAndReconstructImageFilter.h"
#include "clitkExplosionControlledThresholdConnectedImageFilter.h"
-#include "clitkSegmentationFunctions.h"
+#include "clitkSegmentationUtils.h"
+#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
// itk
#include "itkStatisticsImageFilter.h"
*/
//--------------------------------------------------------------------
- template <class TInputImageType, class TOutputImageType>
+ template <class TInputImageType>
class ITK_EXPORT ExtractBonesFilter:
- 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 ExtractBonesFilter 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 ExtractBonesFilter 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;
void SetArgsInfo(ArgsInfoType arg);
// Background / Foreground
- itkGetConstMacro(BackgroundValue, OutputImagePixelType);
- itkGetConstMacro(ForegroundValue, OutputImagePixelType);
+ itkGetConstMacro(BackgroundValue, MaskImagePixelType);
+ itkGetConstMacro(ForegroundValue, MaskImagePixelType);
itkSetMacro(MinimalComponentSize, int);
itkGetConstMacro(MinimalComponentSize, int);
GGO_DefineOption(minSize, SetMinimalComponentSize, int);
+
+ // Output filename (for AFBD)
+ itkSetMacro(OutputBonesFilename, std::string);
+ itkGetMacro(OutputBonesFilename, std::string);
+ GGO_DefineOption(output, SetOutputBonesFilename, std::string);
+
+ // Step 0
+ itkBooleanMacro(InitialSmoothing);
+ itkSetMacro(InitialSmoothing, bool);
+ itkGetMacro(InitialSmoothing, bool);
+ GGO_DefineOption_Flag(smooth, SetInitialSmoothing);
+
+ itkSetMacro(SmoothingConductanceParameter, double);
+ itkGetConstMacro(SmoothingConductanceParameter, double);
+ GGO_DefineOption(cond, SetSmoothingConductanceParameter, double);
+
+ itkSetMacro(SmoothingNumberOfIterations, int);
+ itkGetConstMacro(SmoothingNumberOfIterations, int);
+ GGO_DefineOption(iter, SetSmoothingNumberOfIterations, int);
+
+ itkSetMacro(SmoothingTimeStep, double);
+ itkGetConstMacro(SmoothingTimeStep, double);
+ GGO_DefineOption(time, SetSmoothingTimeStep, double);
+
+ itkSetMacro(SmoothingUseImageSpacing, bool);
+ itkGetConstMacro(SmoothingUseImageSpacing, bool);
+ itkBooleanMacro(SmoothingUseImageSpacing);
+ GGO_DefineOption_Flag(spacing, SetSmoothingUseImageSpacing);
// Step 1
itkSetMacro(UpperThreshold1, InputImagePixelType);
itkSetMacro(AutoCrop, bool);
itkGetConstMacro(AutoCrop, bool);
itkBooleanMacro(AutoCrop);
- GGO_DefineOption_Flag(autoCrop, SetAutoCrop);
+ GGO_DefineOption_Flag(noAutoCrop, SetAutoCrop);
protected:
ExtractBonesFilter();
virtual ~ExtractBonesFilter() {}
// Global options
- itkSetMacro(BackgroundValue, OutputImagePixelType);
- itkSetMacro(ForegroundValue, OutputImagePixelType);
- OutputImagePixelType m_BackgroundValue;
- OutputImagePixelType m_ForegroundValue;
+ itkSetMacro(BackgroundValue, MaskImagePixelType);
+ itkSetMacro(ForegroundValue, MaskImagePixelType);
+ MaskImagePixelType m_BackgroundValue;
+ MaskImagePixelType m_ForegroundValue;
+ bool m_AutoCrop;
+
+ // Step 0 : Initial Filtering
+ bool m_InitialSmoothing;
+ double m_SmoothingConductanceParameter;
+ int m_SmoothingNumberOfIterations;
+ double m_SmoothingTimeStep;
+ bool m_SmoothingUseImageSpacing;
// Step 1
InputImagePixelType m_UpperThreshold1;
InputImageSizeType m_Radius2;
int m_SampleRate2;
- bool m_AutoCrop;
-
virtual void GenerateOutputInformation();
virtual void GenerateData();
void ExtractBones();
void RemoveTrachea();
void BonesSeparation();
+ std::string m_OutputBonesFilename;
InputImageConstPointer input;
- OutputImageConstPointer patient;
+ InputImagePointer filtered_input;
+ MaskImageConstPointer patient;
InputImagePointer working_input;
typename InternalImageType::Pointer working_image;
typename InternalImageType::Pointer trachea;