X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLymphStationsFilter.txx;h=9051ec154df9cf5c8a8cc94cb640556a27f73819;hb=15e781be4b87a75be8fe01e56da5eb4435c97786;hp=520038c89785c58abc9eab9b8a35c8bb1c4bbaae;hpb=8f785a7646e65eb73b28e274871b2aafcb34d85c;p=clitk.git diff --git a/segmentation/clitkExtractLymphStationsFilter.txx b/segmentation/clitkExtractLymphStationsFilter.txx index 520038c..9051ec1 100644 --- a/segmentation/clitkExtractLymphStationsFilter.txx +++ b/segmentation/clitkExtractLymphStationsFilter.txx @@ -50,9 +50,7 @@ template clitk::ExtractLymphStationsFilter:: ExtractLymphStationsFilter(): - clitk::FilterBase(), - clitk::FilterWithAnatomicalFeatureDatabaseManagement(), - itk::ImageToImageFilter() + clitk::StructuresExtractionFilter() { this->SetNumberOfRequiredInputs(1); SetBackgroundValue(0); @@ -60,11 +58,17 @@ ExtractLymphStationsFilter(): ComputeStationsSupportsFlagOn(); // Default values - ExtractStation_8_SetDefaultValues(); ExtractStation_3P_SetDefaultValues(); ExtractStation_2RL_SetDefaultValues(); ExtractStation_3A_SetDefaultValues(); + ExtractStation_1RL_SetDefaultValues(); + ExtractStation_4RL_SetDefaultValues(); + ExtractStation_5_SetDefaultValues(); + ExtractStation_6_SetDefaultValues(); + + // TODO ExtractStation_7_SetDefaultValues(); + ExtractStation_8_SetDefaultValues(); } //-------------------------------------------------------------------- @@ -75,78 +79,72 @@ void clitk::ExtractLymphStationsFilter:: GenerateOutputInformation() { // Get inputs - LoadAFDB(); + this->LoadAFDB(); m_Input = dynamic_cast(itk::ProcessObject::GetInput(0)); - m_Mediastinum = GetAFDB()->template GetImage ("Mediastinum"); + m_Mediastinum = this->GetAFDB()->template GetImage ("Mediastinum"); // Clean some computer landmarks to force the recomputation - GetAFDB()->RemoveTag("AntPostVesselsSeparation"); + this->GetAFDB()->RemoveTag("AntPostVesselsSeparation"); // Global supports for stations - if (GetComputeStationsSupportsFlag()) { - StartNewStep("Supports for stations"); - StartSubStep(); - GetAFDB()->RemoveTag("CarinaZ"); - GetAFDB()->RemoveTag("ApexOfTheChestZ"); - GetAFDB()->RemoveTag("ApexOfTheChest"); - GetAFDB()->RemoveTag("RightBronchus"); - GetAFDB()->RemoveTag("LeftBronchus"); - GetAFDB()->RemoveTag("SuperiorBorderOfAorticArchZ"); - GetAFDB()->RemoveTag("SuperiorBorderOfAorticArch"); - GetAFDB()->RemoveTag("InferiorBorderOfAorticArchZ"); - GetAFDB()->RemoveTag("InferiorBorderOfAorticArch"); - ExtractStationSupports(); - StopSubStep(); - } - else { - m_ListOfSupports["S1R"] = GetAFDB()->template GetImage("Support_S1R"); - m_ListOfSupports["S1L"] = GetAFDB()->template GetImage("Support_S1L"); - m_ListOfSupports["S2R"] = GetAFDB()->template GetImage("Support_S2R"); - m_ListOfSupports["S2L"] = GetAFDB()->template GetImage("Support_S2L"); - m_ListOfSupports["S4R"] = GetAFDB()->template GetImage("Support_S4R"); - m_ListOfSupports["S4L"] = GetAFDB()->template GetImage("Support_S4L"); - - m_ListOfSupports["S3A"] = GetAFDB()->template GetImage("Support_S3A"); - m_ListOfSupports["S3P"] = GetAFDB()->template GetImage("Support_S3P"); - m_ListOfSupports["S5"] = GetAFDB()->template GetImage("Support_S5"); - m_ListOfSupports["S6"] = GetAFDB()->template GetImage("Support_S6"); - m_ListOfSupports["S7"] = GetAFDB()->template GetImage("Support_S7"); - m_ListOfSupports["S8"] = GetAFDB()->template GetImage("Support_S8"); - m_ListOfSupports["S9"] = GetAFDB()->template GetImage("Support_S9"); - m_ListOfSupports["S10"] = GetAFDB()->template GetImage("Support_S10"); - m_ListOfSupports["S11"] = GetAFDB()->template GetImage("Support_S11"); + bool supportsExist = true; + try { + m_ListOfSupports["S1R"] = this->GetAFDB()->template GetImage("Support_S1R"); + m_ListOfSupports["S1L"] = this->GetAFDB()->template GetImage("Support_S1L"); + m_ListOfSupports["S2R"] = this->GetAFDB()->template GetImage("Support_S2R"); + m_ListOfSupports["S2L"] = this->GetAFDB()->template GetImage("Support_S2L"); + m_ListOfSupports["S4R"] = this->GetAFDB()->template GetImage("Support_S4R"); + m_ListOfSupports["S4L"] = this->GetAFDB()->template GetImage("Support_S4L"); + + m_ListOfSupports["S3A"] = this->GetAFDB()->template GetImage("Support_S3A"); + m_ListOfSupports["S3P"] = this->GetAFDB()->template GetImage("Support_S3P"); + m_ListOfSupports["S5"] = this->GetAFDB()->template GetImage("Support_S5"); + m_ListOfSupports["S6"] = this->GetAFDB()->template GetImage("Support_S6"); + m_ListOfSupports["S7"] = this->GetAFDB()->template GetImage("Support_S7"); + m_ListOfSupports["S8"] = this->GetAFDB()->template GetImage("Support_S8"); + m_ListOfSupports["S9"] = this->GetAFDB()->template GetImage("Support_S9"); + m_ListOfSupports["S10"] = this->GetAFDB()->template GetImage("Support_S10"); + m_ListOfSupports["S11"] = this->GetAFDB()->template GetImage("Support_S11"); + } catch(clitk::ExceptionObject o) { + supportsExist = false; } - // Extract Station8 - ExtractStation_8(); + if (!supportsExist || GetComputeStationsSupportsFlag()) { + this->StartNewStep("Supports for stations"); + this->StartSubStep(); + this->GetAFDB()->RemoveTag("CarinaZ"); + this->GetAFDB()->RemoveTag("ApexOfTheChestZ"); + this->GetAFDB()->RemoveTag("ApexOfTheChest"); + this->GetAFDB()->RemoveTag("RightBronchus"); + this->GetAFDB()->RemoveTag("LeftBronchus"); + this->GetAFDB()->RemoveTag("SuperiorBorderOfAorticArchZ"); + this->GetAFDB()->RemoveTag("SuperiorBorderOfAorticArch"); + this->GetAFDB()->RemoveTag("InferiorBorderOfAorticArchZ"); + this->GetAFDB()->RemoveTag("InferiorBorderOfAorticArch"); + ExtractStationSupports(); + this->StopSubStep(); + } - // Extract Station3P + // Extract Stations ExtractStation_3P(); - - // Extract Station3A ExtractStation_3A(); + ExtractStation_2RL(); + ExtractStation_1RL(); + ExtractStation_4RL(); + ExtractStation_5(); + ExtractStation_6(); - // HERE + // ---------- TODO ----------------------- - // Extract Station2RL - StartNewStep("Station 2RL"); - StartSubStep(); - ExtractStation_2RL(); - StopSubStep(); + // Extract Station8 + ExtractStation_8(); // Extract Station7 - StartNewStep("Station 7"); - StartSubStep(); + this->StartNewStep("Station 7"); + this->StartSubStep(); ExtractStation_7(); - StopSubStep(); - - if (0) { // temporary suppress - // Extract Station4RL - StartNewStep("Station 4RL"); - StartSubStep(); - //ExtractStation_4RL(); - StopSubStep(); - } + this->StopSubStep(); + } //-------------------------------------------------------------------- @@ -184,8 +182,8 @@ CheckForStation(std::string station) // Check if station already exist in DB bool found = false; - if (GetAFDB()->TagExist(s)) { - m_ListOfStations[station] = GetAFDB()->template GetImage(s); + if (this->GetAFDB()->TagExist(s)) { + m_ListOfStations[station] = this->GetAFDB()->template GetImage(s); found = true; } @@ -194,7 +192,7 @@ CheckForStation(std::string station) std::cout << "Station " << station << " already exists, but re-computation forced." << std::endl; } if (!found || GetComputeStation(station)) { - m_Working_Support = m_Mediastinum = GetAFDB()->template GetImage("Mediastinum", true); + m_Working_Support = m_Mediastinum = this->GetAFDB()->template GetImage("Mediastinum", true); return true; } else { @@ -305,23 +303,6 @@ void ComputeImageBoundariesCoordinates(typename ImageType::Pointer image, //-------------------------------------------------------------------- -//-------------------------------------------------------------------- -template -void -clitk::ExtractLymphStationsFilter:: -ExtractStation_4RL() { - DD("TODO"); - exit(0); - /* - WARNING ONLY 4R FIRST !!! (not same inf limits) - */ - ExtractStation_4RL_SI_Limits(); - ExtractStation_4RL_LR_Limits(); - ExtractStation_4RL_AP_Limits(); -} -//-------------------------------------------------------------------- - - //-------------------------------------------------------------------- template void @@ -329,8 +310,8 @@ clitk::ExtractLymphStationsFilter:: Remove_Structures(std::string station, std::string s) { try { - StartNewStep("[Station"+station+"] Remove "+s); - MaskImagePointer Structure = GetAFDB()->template GetImage(s); + this->StartNewStep("[Station"+station+"] Remove "+s); + MaskImagePointer Structure = this->GetAFDB()->template GetImage(s); clitk::AndNot(m_Working_Support, Structure, GetBackgroundValue()); } catch(clitk::ExceptionObject e) { @@ -351,6 +332,17 @@ SetFuzzyThreshold(std::string station, std::string tag, double value) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +template +void +clitk::ExtractLymphStationsFilter:: +SetThreshold(std::string station, std::string tag, double value) +{ + m_Threshold[station][tag] = value; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template double @@ -372,6 +364,27 @@ GetFuzzyThreshold(std::string station, std::string tag) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +template +double +clitk::ExtractLymphStationsFilter:: +GetThreshold(std::string station, std::string tag) +{ + if (m_Threshold.find(station) == m_Threshold.end()) { + clitkExceptionMacro("Could not find options for station "+station+" in the list (while searching for tag "+tag+")."); + return 0.0; + } + + if (m_Threshold[station].find(tag) == m_Threshold[station].end()) { + clitkExceptionMacro("Could not find options "+tag+" in the list of Threshold for station "+station+"."); + return 0.0; + } + + return m_Threshold[station][tag]; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template void @@ -383,22 +396,22 @@ FindLineForS7S8Separation(MaskImagePointType & A, MaskImagePointType & B) // B = lower border of bronchus intermedius (BI) or RightMiddleLobeBronchus try { - GetAFDB()->GetPoint3D("LineForS7S8Separation_Begin", A); - GetAFDB()->GetPoint3D("LineForS7S8Separation_End", B); + this->GetAFDB()->GetPoint3D("LineForS7S8Separation_Begin", A); + this->GetAFDB()->GetPoint3D("LineForS7S8Separation_End", B); } catch(clitk::ExceptionObject & o) { DD("FindLineForS7S8Separation"); // Load LeftLowerLobeBronchus and get centroid point MaskImagePointer LeftLowerLobeBronchus = - GetAFDB()->template GetImage ("LeftLowerLobeBronchus"); + this->GetAFDB()->template GetImage ("LeftLowerLobeBronchus"); std::vector c; clitk::ComputeCentroids(LeftLowerLobeBronchus, GetBackgroundValue(), c); A = c[1]; // Load RightMiddleLobeBronchus and get superior point (not centroid here) MaskImagePointer RightMiddleLobeBronchus = - GetAFDB()->template GetImage ("RightMiddleLobeBronchus"); + this->GetAFDB()->template GetImage ("RightMiddleLobeBronchus"); bool b = FindExtremaPointInAGivenDirection(RightMiddleLobeBronchus, GetBackgroundValue(), 2, false, B); @@ -407,8 +420,8 @@ FindLineForS7S8Separation(MaskImagePointType & A, MaskImagePointType & B) } // Insert into the DB - GetAFDB()->SetPoint3D("LineForS7S8Separation_Begin", A); - GetAFDB()->SetPoint3D("LineForS7S8Separation_End", B); + this->GetAFDB()->SetPoint3D("LineForS7S8Separation_Begin", A); + this->GetAFDB()->SetPoint3D("LineForS7S8Separation_End", B); } } //-------------------------------------------------------------------- @@ -422,24 +435,24 @@ FindCarina() { double z; try { - z = GetAFDB()->GetDouble("CarinaZ"); + z = this->GetAFDB()->GetDouble("CarinaZ"); } catch(clitk::ExceptionObject e) { DD("FindCarinaSlicePosition"); // Get Carina - MaskImagePointer Carina = GetAFDB()->template GetImage("Carina"); + MaskImagePointer Carina = this->GetAFDB()->template GetImage("Carina"); // Get Centroid and Z value std::vector centroids; clitk::ComputeCentroids(Carina, GetBackgroundValue(), centroids); // We dont need Carina structure from now - GetAFDB()->template ReleaseImage("Carina"); + this->GetAFDB()->template ReleaseImage("Carina"); // Put inside the AFDB - GetAFDB()->SetPoint3D("CarinaPoint", centroids[1]); - GetAFDB()->SetDouble("CarinaZ", centroids[1][2]); - WriteAFDB(); + this->GetAFDB()->SetPoint3D("CarinaPoint", centroids[1]); + this->GetAFDB()->SetDouble("CarinaZ", centroids[1][2]); + this->WriteAFDB(); z = centroids[1][2]; } return z; @@ -455,23 +468,23 @@ FindApexOfTheChest() { double z; try { - z = GetAFDB()->GetDouble("ApexOfTheChestZ"); + z = this->GetAFDB()->GetDouble("ApexOfTheChestZ"); } catch(clitk::ExceptionObject e) { DD("FindApexOfTheChestPosition"); - MaskImagePointer Lungs = GetAFDB()->template GetImage("Lungs"); + MaskImagePointer Lungs = this->GetAFDB()->template GetImage("Lungs"); MaskImagePointType p; p[0] = p[1] = p[2] = 0.0; // to avoid warning clitk::FindExtremaPointInAGivenDirection(Lungs, GetBackgroundValue(), 2, false, p); // We dont need Lungs structure from now - GetAFDB()->template ReleaseImage("Lungs"); + this->GetAFDB()->template ReleaseImage("Lungs"); // Put inside the AFDB - GetAFDB()->SetPoint3D("ApexOfTheChest", p); + this->GetAFDB()->SetPoint3D("ApexOfTheChest", p); p[2] -= 5; // We consider 5 mm lower - GetAFDB()->SetDouble("ApexOfTheChestZ", p[2]); - WriteAFDB(); + this->GetAFDB()->SetDouble("ApexOfTheChestZ", p[2]); + this->WriteAFDB(); z = p[2]; } return z; @@ -486,8 +499,8 @@ clitk::ExtractLymphStationsFilter:: FindLeftAndRightBronchi() { try { - m_RightBronchus = GetAFDB()->template GetImage ("RightBronchus"); - m_LeftBronchus = GetAFDB()->template GetImage ("LeftBronchus"); + m_RightBronchus = this->GetAFDB()->template GetImage ("RightBronchus"); + m_LeftBronchus = this->GetAFDB()->template GetImage ("LeftBronchus"); } catch(clitk::ExceptionObject & o) { @@ -496,7 +509,7 @@ FindLeftAndRightBronchi() // a Left and Right bronchus. // Get the trachea - MaskImagePointer Trachea = GetAFDB()->template GetImage("Trachea"); + MaskImagePointer Trachea = this->GetAFDB()->template GetImage("Trachea"); // Get the Carina position double m_CarinaZ = FindCarina(); @@ -563,9 +576,9 @@ FindLeftAndRightBronchi() LeftBronchus = clitk::AutoCrop(LeftBronchus, GetBackgroundValue()); // Insert int AFDB if need after - GetAFDB()->template SetImage ("RightBronchus", "seg/rightBronchus.mhd", + this->GetAFDB()->template SetImage ("RightBronchus", "seg/rightBronchus.mhd", RightBronchus, true); - GetAFDB()->template SetImage ("LeftBronchus", "seg/leftBronchus.mhd", + this->GetAFDB()->template SetImage ("LeftBronchus", "seg/leftBronchus.mhd", LeftBronchus, true); } } @@ -580,23 +593,23 @@ FindSuperiorBorderOfAorticArch() { double z; try { - z = GetAFDB()->GetDouble("SuperiorBorderOfAorticArchZ"); + z = this->GetAFDB()->GetDouble("SuperiorBorderOfAorticArchZ"); } catch(clitk::ExceptionObject e) { DD("FindSuperiorBorderOfAorticArch"); - MaskImagePointer Aorta = GetAFDB()->template GetImage("Aorta"); + MaskImagePointer Aorta = this->GetAFDB()->template GetImage("Aorta"); MaskImagePointType p; p[0] = p[1] = p[2] = 0.0; // to avoid warning clitk::FindExtremaPointInAGivenDirection(Aorta, GetBackgroundValue(), 2, false, p); p[2] += Aorta->GetSpacing()[2]; // the slice above // We dont need Lungs structure from now - GetAFDB()->template ReleaseImage("Aorta"); + this->GetAFDB()->template ReleaseImage("Aorta"); // Put inside the AFDB - GetAFDB()->SetPoint3D("SuperiorBorderOfAorticArch", p); - GetAFDB()->SetDouble("SuperiorBorderOfAorticArchZ", p[2]); - WriteAFDB(); + this->GetAFDB()->SetPoint3D("SuperiorBorderOfAorticArch", p); + this->GetAFDB()->SetDouble("SuperiorBorderOfAorticArchZ", p[2]); + this->WriteAFDB(); z = p[2]; } return z; @@ -612,11 +625,11 @@ FindInferiorBorderOfAorticArch() { double z; try { - z = GetAFDB()->GetDouble("InferiorBorderOfAorticArchZ"); + z = this->GetAFDB()->GetDouble("InferiorBorderOfAorticArchZ"); } catch(clitk::ExceptionObject e) { DD("FindInferiorBorderOfAorticArch"); - MaskImagePointer Aorta = GetAFDB()->template GetImage("Aorta"); + MaskImagePointer Aorta = this->GetAFDB()->template GetImage("Aorta"); std::vector slices; clitk::ExtractSlices(Aorta, 2, slices); bool found=false; @@ -639,12 +652,12 @@ FindInferiorBorderOfAorticArch() Aorta->TransformIndexToPhysicalPoint(index, lower); // We dont need Lungs structure from now - GetAFDB()->template ReleaseImage("Aorta"); + this->GetAFDB()->template ReleaseImage("Aorta"); // Put inside the AFDB - GetAFDB()->SetPoint3D("InferiorBorderOfAorticArch", lower); - GetAFDB()->SetDouble("InferiorBorderOfAorticArchZ", lower[2]); - WriteAFDB(); + this->GetAFDB()->SetPoint3D("InferiorBorderOfAorticArch", lower); + this->GetAFDB()->SetDouble("InferiorBorderOfAorticArchZ", lower[2]); + this->WriteAFDB(); z = lower[2]; } return z; @@ -656,7 +669,7 @@ FindInferiorBorderOfAorticArch() template typename clitk::ExtractLymphStationsFilter::MaskImagePointer clitk::ExtractLymphStationsFilter:: -FindAntPostVessels() +FindAntPostVesselsOLD() { // ----------------------------------------------------- /* Rod says: "The anterior border, as with the Atlas – UM, is @@ -672,11 +685,9 @@ FindAntPostVessels() bool found = true; MaskImagePointer binarizedContour; try { - DD("FindAntPostVessels try to get"); - binarizedContour = GetAFDB()->template GetImage ("AntPostVesselsSeparation"); + binarizedContour = this->GetAFDB()->template GetImage ("AntPostVesselsSeparation"); } catch(clitk::ExceptionObject e) { - DD("not found"); found = false; } if (found) { @@ -701,22 +712,22 @@ FindAntPostVessels() */ // Read structures - MaskImagePointer BrachioCephalicArtery = GetAFDB()->template GetImage("BrachioCephalicArtery"); - MaskImagePointer BrachioCephalicVein = GetAFDB()->template GetImage("BrachioCephalicVein"); - MaskImagePointer CommonCarotidArtery = GetAFDB()->template GetImage("CommonCarotidArtery"); - MaskImagePointer SubclavianArtery = GetAFDB()->template GetImage("SubclavianArtery"); - MaskImagePointer Thyroid = GetAFDB()->template GetImage("Thyroid"); - MaskImagePointer Aorta = GetAFDB()->template GetImage("Aorta"); - MaskImagePointer Trachea = GetAFDB()->template GetImage("Trachea"); + MaskImagePointer BrachioCephalicArtery = this->GetAFDB()->template GetImage("BrachioCephalicArtery"); + MaskImagePointer BrachioCephalicVein = this->GetAFDB()->template GetImage("BrachioCephalicVein"); + MaskImagePointer CommonCarotidArtery = this->GetAFDB()->template GetImage("CommonCarotidArtery"); + MaskImagePointer SubclavianArtery = this->GetAFDB()->template GetImage("SubclavianArtery"); + MaskImagePointer Thyroid = this->GetAFDB()->template GetImage("Thyroid"); + MaskImagePointer Aorta = this->GetAFDB()->template GetImage("Aorta"); + MaskImagePointer Trachea = this->GetAFDB()->template GetImage("Trachea"); // Create a temporay support // From first slice of BrachioCephalicVein to end of 3A - MaskImagePointer support = GetAFDB()->template GetImage("Support_Sup_Carina"); + MaskImagePointer support = this->GetAFDB()->template GetImage("Support_Sup_Carina"); MaskImagePointType p; p[0] = p[1] = p[2] = 0.0; // to avoid warning clitk::FindExtremaPointInAGivenDirection(BrachioCephalicVein, GetBackgroundValue(), 2, true, p); double inf = p [2]; - clitk::FindExtremaPointInAGivenDirection(GetAFDB()->template GetImage("Support_S3A"), + clitk::FindExtremaPointInAGivenDirection(this->GetAFDB()->template GetImage("Support_S3A"), GetBackgroundValue(), 2, false, p); double sup = p [2]; support = clitk::CropImageAlongOneAxis(support, 2, inf, sup, @@ -978,8 +989,8 @@ FindAntPostVessels() false, GetBackgroundValue()); // Update the AFDB writeImage(binarizedContour, "seg/AntPostVesselsSeparation.mhd"); - GetAFDB()->SetImageFilename("AntPostVesselsSeparation", "seg/AntPostVesselsSeparation.mhd"); - WriteAFDB(); + this->GetAFDB()->SetImageFilename("AntPostVesselsSeparation", "seg/AntPostVesselsSeparation.mhd"); + this->WriteAFDB(); return binarizedContour; /* @@ -1014,21 +1025,6 @@ FindAntPostVessels() //-------------------------------------------------------------------- - - - - - - - - - - - - - - - //-------------------------------------------------------------------- template typename clitk::ExtractLymphStationsFilter::MaskImagePointer @@ -1049,11 +1045,9 @@ FindAntPostVessels2() bool found = true; MaskImagePointer binarizedContour; try { - DD("FindAntPostVessels try to get"); - binarizedContour = GetAFDB()->template GetImage ("AntPostVesselsSeparation"); + binarizedContour = this->GetAFDB()->template GetImage ("AntPostVesselsSeparation"); } catch(clitk::ExceptionObject e) { - DD("not found"); found = false; } if (found) { @@ -1080,28 +1074,33 @@ FindAntPostVessels2() // Read structures std::map MapOfStructures; typedef std::map::iterator MapIter; - MapOfStructures["BrachioCephalicArtery"] = GetAFDB()->template GetImage("BrachioCephalicArtery"); - MapOfStructures["BrachioCephalicVein"] = GetAFDB()->template GetImage("BrachioCephalicVein"); - MapOfStructures["CommonCarotidArteryLeft"] = GetAFDB()->template GetImage("CommonCarotidArteryLeft"); - MapOfStructures["CommonCarotidArteryRight"] = GetAFDB()->template GetImage("CommonCarotidArteryRight"); - MapOfStructures["SubclavianArteryLeft"] = GetAFDB()->template GetImage("SubclavianArteryLeft"); - MapOfStructures["SubclavianArteryRight"] = GetAFDB()->template GetImage("SubclavianArteryRight"); - MapOfStructures["Thyroid"] = GetAFDB()->template GetImage("Thyroid"); - MapOfStructures["Aorta"] = GetAFDB()->template GetImage("Aorta"); - MapOfStructures["Trachea"] = GetAFDB()->template GetImage("Trachea"); + MapOfStructures["BrachioCephalicArtery"] = this->GetAFDB()->template GetImage("BrachioCephalicArtery"); + MapOfStructures["BrachioCephalicVein"] = this->GetAFDB()->template GetImage("BrachioCephalicVein"); + MapOfStructures["CommonCarotidArteryLeft"] = this->GetAFDB()->template GetImage("CommonCarotidArteryLeft"); + MapOfStructures["CommonCarotidArteryRight"] = this->GetAFDB()->template GetImage("CommonCarotidArteryRight"); + MapOfStructures["SubclavianArteryLeft"] = this->GetAFDB()->template GetImage("SubclavianArteryLeft"); + MapOfStructures["SubclavianArteryRight"] = this->GetAFDB()->template GetImage("SubclavianArteryRight"); + MapOfStructures["Thyroid"] = this->GetAFDB()->template GetImage("Thyroid"); + MapOfStructures["Aorta"] = this->GetAFDB()->template GetImage("Aorta"); + MapOfStructures["Trachea"] = this->GetAFDB()->template GetImage("Trachea"); std::vector ListOfStructuresNames; // Create a temporay support - // From first slice of BrachioCephalicVein to end of 3A - MaskImagePointer support = GetAFDB()->template GetImage("Support_Sup_Carina"); + // From first slice of BrachioCephalicVein to end of 3A or end of 2RL + MaskImagePointer support = this->GetAFDB()->template GetImage("Support_Sup_Carina"); MaskImagePointType p; p[0] = p[1] = p[2] = 0.0; // to avoid warning clitk::FindExtremaPointInAGivenDirection(MapOfStructures["BrachioCephalicVein"], GetBackgroundValue(), 2, true, p); double inf = p[2]; - clitk::FindExtremaPointInAGivenDirection(GetAFDB()->template GetImage("Support_S3A"), + clitk::FindExtremaPointInAGivenDirection(this->GetAFDB()->template GetImage("Support_S3A"), GetBackgroundValue(), 2, false, p); + MaskImagePointType p2; + clitk::FindExtremaPointInAGivenDirection(this->GetAFDB()->template GetImage("Support_S2L"), + GetBackgroundValue(), 2, false, p2); + if (p2[2] > p[2]) p = p2; + double sup = p[2]+support->GetSpacing()[2];//one slice more ? support = clitk::CropImageAlongOneAxis(support, 2, inf, sup, false, GetBackgroundValue()); @@ -1349,8 +1348,8 @@ FindAntPostVessels2() // Update the AFDB writeImage(binarizedContour, "seg/AntPostVesselsSeparation.mhd"); - GetAFDB()->SetImageFilename("AntPostVesselsSeparation", "seg/AntPostVesselsSeparation.mhd"); - WriteAFDB(); + this->GetAFDB()->SetImageFilename("AntPostVesselsSeparation", "seg/AntPostVesselsSeparation.mhd"); + this->WriteAFDB(); return binarizedContour; /*