#include "clitkExtractMediastinumFilter.h"
#include "clitkAddRelativePositionConstraintToLabelImageFilter.h"
#include "clitkSegmentationUtils.h"
-#include "clitkExtractAirwayTreeInfoFilter.h"
+#include "clitkExtractAirwaysTreeInfoFilter.h"
-// itk
+// std
#include <deque>
+
+// itk
#include "itkStatisticsLabelMapFilter.h"
#include "itkLabelImageToStatisticsLabelMapFilter.h"
#include "itkRegionOfInterestImageFilter.h"
clitk::ExtractMediastinumFilter<ImageType>::
ExtractMediastinumFilter():
clitk::FilterBase(),
+ clitk::FilterWithAnatomicalFeatureDatabaseManagement(),
itk::ImageToImageFilter<ImageType, ImageType>()
{
this->SetNumberOfRequiredInputs(4);
SetForegroundValue(1);
SetIntermediateSpacing(6);
- SetFuzzyThreshold1(0.6);
- SetFuzzyThreshold2(0.7);
+ SetFuzzyThreshold1(0.4);
+ SetFuzzyThreshold2(0.6);
+ SetFuzzyThreshold3(0.2);
}
//--------------------------------------------------------------------
SetIntermediateSpacing_GGO(mArgsInfo);
SetFuzzyThreshold1_GGO(mArgsInfo);
SetFuzzyThreshold2_GGO(mArgsInfo);
+ SetFuzzyThreshold3_GGO(mArgsInfo);
}
//--------------------------------------------------------------------
ImageConstPointer bones_ant;
ImageConstPointer bones_post;
- // Find ant-post coordinate of trachea (assume the first point is a
+ // Find ant-post coordinate of trachea (assume the carena position is a
// good estimation of the ant-post position of the trachea)
- typedef clitk::ExtractAirwayTreeInfoFilter<ImageType> AirwayFilter;
- typename AirwayFilter::Pointer airwayfilter = AirwayFilter::New();
- airwayfilter->SetInput(trachea);
- airwayfilter->Update();
- DD(airwayfilter->GetFirstTracheaPoint());
- ImagePointType point_trachea = airwayfilter->GetFirstTracheaPoint();
+ ImagePointType carina;
+ LoadAFDB();
+ GetAFDB()->GetPoint3D("Carina", carina);
+ DD(carina);
ImageIndexType index_trachea;
- bones->TransformPhysicalPointToIndex(point_trachea, index_trachea);
+ bones->TransformPhysicalPointToIndex(carina, index_trachea);
DD(index_trachea);
// Split bone image first into two parts (ant and post)
// cropFilter->ResetPipeline();// = CropFilterType::New();
cropFilter = CropFilterType::New();
ImageIndexType index = region.GetIndex();
- size[1] = bones->GetLargestPossibleRegion().GetSize()[1] - size[1];
index[1] = bones->GetLargestPossibleRegion().GetIndex()[1] + size[1]-1;
+ size[1] = bones->GetLargestPossibleRegion().GetSize()[1] - size[1];
DD(size);
region.SetIndex(index);
region.SetSize(size);
output = clitk::KeepLabels<ImageType>(output, GetBackgroundValue(),
GetForegroundValue(), 1, 1, 0);
+
+ // Step : Lower limits from lung (need separate lung ?)
+ StartNewStep("Lower limits with lungs");
+ relPosFilter = RelPosFilterType::New();
+ relPosFilter->SetCurrentStepBaseId(this->GetCurrentStepId());
+ relPosFilter->VerboseStepOff();
+ relPosFilter->WriteStepOff();
+ relPosFilter->SetInput(output);
+ DD(output->GetLargestPossibleRegion().GetIndex());
+ // relPosFilter->SetInputObject(left_lung);
+ relPosFilter->SetInputObject(lung);
+ relPosFilter->SetOrientationType(RelPosFilterType::SupTo);
+ relPosFilter->SetIntermediateSpacing(GetIntermediateSpacing());
+ relPosFilter->SetFuzzyThreshold(GetFuzzyThreshold3());
+ relPosFilter->Update();
+ output = relPosFilter->GetOutput();
+ DD(output->GetLargestPossibleRegion());
+
output = clitk::AutoCrop<ImageType>(output, GetBackgroundValue());
// cropFilter = CropFilterType::New();
//cropFilter->SetInput(output);