X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractMediastinumFilter.txx;h=7f5ca18aec5fccdf23411fd5ae39bc06612b6a87;hb=880e33e1299652f7a55ff47b8d65eb89f5578e5e;hp=fde335c28ada90f738bc5051673d7554027e2546;hpb=6e16222234a90c6079a8f4696c92de7349a496bb;p=clitk.git diff --git a/segmentation/clitkExtractMediastinumFilter.txx b/segmentation/clitkExtractMediastinumFilter.txx index fde335c..7f5ca18 100644 --- a/segmentation/clitkExtractMediastinumFilter.txx +++ b/segmentation/clitkExtractMediastinumFilter.txx @@ -24,10 +24,12 @@ #include "clitkExtractMediastinumFilter.h" #include "clitkAddRelativePositionConstraintToLabelImageFilter.h" #include "clitkSegmentationUtils.h" -#include "clitkExtractAirwayTreeInfoFilter.h" +#include "clitkExtractAirwaysTreeInfoFilter.h" -// itk +// std #include + +// itk #include "itkStatisticsLabelMapFilter.h" #include "itkLabelImageToStatisticsLabelMapFilter.h" #include "itkRegionOfInterestImageFilter.h" @@ -41,6 +43,7 @@ template clitk::ExtractMediastinumFilter:: ExtractMediastinumFilter(): clitk::FilterBase(), + clitk::FilterWithAnatomicalFeatureDatabaseManagement(), itk::ImageToImageFilter() { this->SetNumberOfRequiredInputs(4); @@ -54,8 +57,9 @@ ExtractMediastinumFilter(): SetForegroundValue(1); SetIntermediateSpacing(6); - SetFuzzyThreshold1(0.6); - SetFuzzyThreshold2(0.7); + SetFuzzyThreshold1(0.4); + SetFuzzyThreshold2(0.6); + SetFuzzyThreshold3(0.2); } //-------------------------------------------------------------------- @@ -133,6 +137,7 @@ SetArgsInfo(ArgsInfoType mArgsInfo) SetIntermediateSpacing_GGO(mArgsInfo); SetFuzzyThreshold1_GGO(mArgsInfo); SetFuzzyThreshold2_GGO(mArgsInfo); + SetFuzzyThreshold3_GGO(mArgsInfo); } //-------------------------------------------------------------------- @@ -252,16 +257,14 @@ GenerateData() 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 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) @@ -285,8 +288,8 @@ GenerateData() // 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); @@ -331,6 +334,24 @@ GenerateData() output = clitk::KeepLabels(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(output, GetBackgroundValue()); // cropFilter = CropFilterType::New(); //cropFilter->SetInput(output);