#ifndef CLITKEXTRACTLYMPHSTATIONSFILTER_H
#define CLITKEXTRACTLYMPHSTATIONSFILTER_H
+// clitk
#include "clitkFilterBase.h"
+#include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
namespace clitk {
template <class TImageType>
class ITK_EXPORT ExtractLymphStationsFilter:
- public clitk::FilterBase,
- public itk::ImageToImageFilter<TImageType, TImageType>
+ public virtual clitk::FilterBase,
+ public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
+ public itk::ImageToImageFilter<TImageType, TImageType>
{
public:
typedef typename ImageType::PixelType ImagePixelType;
typedef typename ImageType::SizeType ImageSizeType;
typedef typename ImageType::IndexType ImageIndexType;
+ typedef typename ImageType::PointType ImagePointType;
/** Connect inputs */
void SetInputMediastinumLabelImage(const TImageType * image, ImagePixelType bg=0);
itkGetConstMacro(BackgroundValue, ImagePixelType);
itkGetConstMacro(ForegroundValue, ImagePixelType);
- itkSetMacro(CarenaZPositionInMM, double);
- itkGetConstMacro(CarenaZPositionInMM, double);
- GGO_DefineOption(carenaZposition, SetCarenaZPositionInMM, double);
+ //itkSetMacro(CarinaZPositionInMM, double);
+ void SetCarinaZPositionInMM(double d) { m_CarinaZPositionInMM = d; Modified(); m_CarinaZPositionInMMIsSet = true; }
+ itkGetConstMacro(CarinaZPositionInMM, double);
+ GGO_DefineOption(carenaZposition, SetCarinaZPositionInMM, double);
itkSetMacro(MiddleLobeBronchusZPositionInMM, double);
itkGetConstMacro(MiddleLobeBronchusZPositionInMM, double);
itkSetMacro(FuzzyThreshold1, double);
itkGetConstMacro(FuzzyThreshold1, double);
GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
-
-
-
+
protected:
ExtractLymphStationsFilter();
virtual ~ExtractLymphStationsFilter() {}
ImagePixelType m_BackgroundValue;
ImagePixelType m_ForegroundValue;
- double m_CarenaZPositionInMM;
+ double m_CarinaZPositionInMM;
+ bool m_CarinaZPositionInMMIsSet;
double m_MiddleLobeBronchusZPositionInMM;
double m_IntermediateSpacing;
double m_FuzzyThreshold1;
clitk::ExtractLymphStationsFilter<TImageType>::
ExtractLymphStationsFilter():
clitk::FilterBase(),
+ clitk::FilterWithAnatomicalFeatureDatabaseManagement(),
itk::ImageToImageFilter<TImageType, TImageType>()
{
this->SetNumberOfRequiredInputs(1);
SetBackgroundValueTrachea(0);
SetBackgroundValue(0);
SetForegroundValue(1);
-
SetIntermediateSpacing(6);
- SetFuzzyThreshold1(0.6);
+ SetFuzzyThreshold1(0.6);
+ m_CarinaZPositionInMMIsSet = false;
}
//--------------------------------------------------------------------
clitk::ExtractLymphStationsFilter<TImageType>::
SetInputMediastinumLabelImage(const TImageType * image, ImagePixelType bg) {
this->SetNthInput(0, const_cast<TImageType *>(image));
- m_BackgroundValueMediastinum = bg;
- SetCarenaZPositionInMM(image->GetOrigin()[2]+image->GetLargestPossibleRegion().GetSize()[2]*image->GetSpacing()[2]);
- SetMiddleLobeBronchusZPositionInMM(image->GetOrigin()[2]);
- // DD(m_CarenaZPositionInMM);
-// DD(m_MiddleLobeBronchusZPositionInMM);
+ SetBackgroundValueMediastinum(bg);
}
//--------------------------------------------------------------------
clitk::ExtractLymphStationsFilter<TImageType>::
SetInputTracheaLabelImage(const TImageType * image, ImagePixelType bg) {
this->SetNthInput(1, const_cast<TImageType *>(image));
- m_BackgroundValueTrachea = bg;
+ SetBackgroundValueTrachea(bg);
}
//--------------------------------------------------------------------
SetVerboseStep_GGO(mArgsInfo);
SetWriteStep_GGO(mArgsInfo);
SetVerboseWarningOff_GGO(mArgsInfo);
- SetCarenaZPositionInMM_GGO(mArgsInfo);
+ SetAFDBFilename_GGO(mArgsInfo);
+ SetCarinaZPositionInMM_GGO(mArgsInfo);
+ m_CarinaZPositionInMMIsSet = false;
SetMiddleLobeBronchusZPositionInMM_GGO(mArgsInfo);
SetIntermediateSpacing_GGO(mArgsInfo);
SetFuzzyThreshold1_GGO(mArgsInfo);
- //SetBackgroundValueMediastinum_GGO(mArgsInfo);
}
//--------------------------------------------------------------------
// Get input
m_mediastinum = dynamic_cast<const TImageType*>(itk::ProcessObject::GetInput(0));
m_trachea = dynamic_cast<const TImageType*>(itk::ProcessObject::GetInput(1));
-
+
+ // Get landmarks information
+ if (!m_CarinaZPositionInMMIsSet) {
+ ImagePointType carina;
+ LoadAFDB();
+ GetAFDB()->GetPoint3D("Carena", carina);
+ DD(carina);
+ m_CarinaZPositionInMM = carina[2];
+ }
+ DD(m_CarinaZPositionInMM);
+
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// Superior limit = carena
ImageRegionType region = m_mediastinum->GetLargestPossibleRegion(); DD(region);
ImageSizeType size = region.GetSize();
ImageIndexType index = region.GetIndex();
- DD(m_CarenaZPositionInMM);
+ DD(m_CarinaZPositionInMM);
DD(m_MiddleLobeBronchusZPositionInMM);
index[2] = floor((m_MiddleLobeBronchusZPositionInMM - m_mediastinum->GetOrigin()[2]) / m_mediastinum->GetSpacing()[2]);
- size[2] = ceil((m_CarenaZPositionInMM-m_MiddleLobeBronchusZPositionInMM) / m_mediastinum->GetSpacing()[2]);
+ size[2] = ceil((m_CarinaZPositionInMM-m_MiddleLobeBronchusZPositionInMM) / m_mediastinum->GetSpacing()[2]);
region.SetSize(size);
region.SetIndex(index);
DD(region);
sliceRelPosFilter->SetInput(m_working_image);
sliceRelPosFilter->SetInputObject(temp);
sliceRelPosFilter->SetDirection(2);
- sliceRelPosFilter->SetFuzzyThreshold(0.5);
+ sliceRelPosFilter->SetFuzzyThreshold(0.6);
sliceRelPosFilter->SetOrientationType(SliceRelPosFilterType::RelPosFilterType::RightTo);
sliceRelPosFilter->Update();
m_working_image = sliceRelPosFilter->GetOutput();
sliceRelPosFilter->SetInput(m_working_image);
sliceRelPosFilter->SetInputObject(temp);
sliceRelPosFilter->SetDirection(2);
- sliceRelPosFilter->SetFuzzyThreshold(0.5);
+ sliceRelPosFilter->SetFuzzyThreshold(0.6);
sliceRelPosFilter->SetOrientationType(SliceRelPosFilterType::RelPosFilterType::LeftTo);
sliceRelPosFilter->Update();
m_working_image = sliceRelPosFilter->GetOutput();