X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractMediastinumFilter.txx;h=675718082192ea3663ada290675da3648b91a5e2;hb=595624eb4297e747630105d45017de69733caef2;hp=312fd14ed01d518cddfed3236b5a0ff720526f00;hpb=4824cfde923f5f1d70fbb0e63aaf08886a8fb28d;p=clitk.git diff --git a/segmentation/clitkExtractMediastinumFilter.txx b/segmentation/clitkExtractMediastinumFilter.txx index 312fd14..6757180 100644 --- a/segmentation/clitkExtractMediastinumFilter.txx +++ b/segmentation/clitkExtractMediastinumFilter.txx @@ -54,7 +54,7 @@ ExtractMediastinumFilter(): SetForegroundValueLeftLung(1); SetForegroundValueRightLung(2); SetDistanceMaxToAnteriorPartOfTheVertebralBody(10); - SetOutputMediastinumFilename("mediastinum.mhd"); + SetOutputMediastinumFilename("mediastinum.mha"); UseBonesOff(); } //-------------------------------------------------------------------- @@ -250,9 +250,9 @@ GenerateOutputInformation() { left_lung = clitk::SetBackground(left_lung, left_lung, 2, 1, false); right_lung = clitk::ResizeImageLike(right_lung, output, this->GetBackgroundValue()); left_lung = clitk::ResizeImageLike(left_lung, output, this->GetBackgroundValue()); - this->GetAFDB()->template SetImage("RightLung", "seg/RightLung.mhd", + this->GetAFDB()->template SetImage("RightLung", "seg/RightLung.mha", right_lung, true); - this->GetAFDB()->template SetImage("LeftLung", "seg/LeftLung.mhd", + this->GetAFDB()->template SetImage("LeftLung", "seg/LeftLung.mha", left_lung, true); this->GetAFDB()->Write(); this->template StopCurrentStep(output); @@ -263,6 +263,7 @@ GenerateOutputInformation() { MaskImagePointer bones_ant; MaskImagePointer bones_post; MaskImagePointType middle_AntPost_position; + middle_AntPost_position.Fill(NumericTraits::Zero); if (GetUseBones()) { this->StartNewStep("[Mediastinum] Ant/Post limits with bones"); @@ -319,12 +320,12 @@ GenerateOutputInformation() { bones_post = roiFilter->GetOutput(); // writeImage(bones_post, "b_post.mhd"); - // Now, insert this image in the AFDB - this->GetAFDB()->template SetImage("Bones_Post", "seg/Bones_Post.mhd", + // Now, insert this image in the AFDB ==> (needed because used in the RelativePosition config file) + this->GetAFDB()->template SetImage("Bones_Post", "seg/Bones_Post.mha", bones_post, true); - this->GetAFDB()->template SetImage("Bones_Ant", "seg/Bones_Ant.mhd", + this->GetAFDB()->template SetImage("Bones_Ant", "seg/Bones_Ant.mha", bones_ant, true); - this->GetAFDB()->Write(); + this->GetAFDB()->Write(); this->template StopCurrentStep(output); } @@ -340,18 +341,27 @@ GenerateOutputInformation() { // Generic RelativePosition processes output = this->ApplyRelativePositionList("Mediastinum", output); + //-------------------------------------------------------------------- + // FIXME --> do not put this limits here ! + /* // Step : SI limits It is better to do this limit *AFTER* the // RelativePosition to avoid some issue due to superior boundaries. this->StartNewStep("[Mediastinum] Keep inferior to CricoidCartilag"); // load Cricoid, get centroid, cut above (or below), lower bound - MaskImagePointer CricoidCartilag = this->GetAFDB()->template GetImage ("CricoidCartilag"); MaskImagePointType p; - p[0] = p[1] = p[2] = 0.0; // to avoid warning - clitk::FindExtremaPointInAGivenDirection(CricoidCartilag, - this->GetBackgroundValue(), 2, true, p); + try { + MaskImagePointer CricoidCartilag = this->GetAFDB()->template GetImage ("CricoidCartilag"); + p[0] = p[1] = p[2] = 0.0; // to avoid warning + clitk::FindExtremaPointInAGivenDirection(CricoidCartilag, + this->GetBackgroundValue(), 2, true, p); + } catch (clitk::ExceptionObject e) { + //DD("CricoidCartilag image not found, try CricoidCartilagZ"); + this->GetAFDB()->GetPoint3D("CricoidCartilagPoint", p); + } output = clitk::CropImageRemoveGreaterThan(output, 2, p[2], true, this->GetBackgroundValue()); this->template StopCurrentStep(output); + */ //-------------------------------------------------------------------- // Step: Get CCL