X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLymphStationsFilter.txx;h=70d540bf636e2b3ba94a110a9a3a7791c1569d1d;hb=bf4928c59a1d39f53fe03deb4b73ecb7e1cf214b;hp=2172dae21b215823d61f01f88b8fb49a4cbe6a98;hpb=72375037f90c596a034b2ebe5e54e209e7b45511;p=clitk.git diff --git a/segmentation/clitkExtractLymphStationsFilter.txx b/segmentation/clitkExtractLymphStationsFilter.txx index 2172dae..70d540b 100644 --- a/segmentation/clitkExtractLymphStationsFilter.txx +++ b/segmentation/clitkExtractLymphStationsFilter.txx @@ -52,14 +52,9 @@ ExtractLymphStationsFilter(): SetBackgroundValue(0); SetForegroundValue(1); - // Station 8 - SetDistanceMaxToAnteriorPartOfTheSpine(10); - MaskImagePointType p; - p[0] = 15; p[1] = 2; p[2] = 1; - SetEsophagusDiltationForAnt(p); - p[0] = 5; p[1] = 10; p[2] = 1; - SetEsophagusDiltationForRight(p); - SetFuzzyThresholdForS8(0.5); + // Default values + ExtractStation_8_SetDefaultValues(); + ExtractStation_3P_SetDefaultValues(); // Station 7 SetFuzzyThreshold(0.5); @@ -84,14 +79,13 @@ GenerateOutputInformation() { ExtractStation_8(); StopSubStep(); - // Compute some interesting points in trachea - // ( ALTERNATIVE -> SKELETON ANALYSIS ? - // Pb : not sufficient for mostXX points ... ) + DD(GetCurrentStepNumber()); - /* ==> todo (but why ???) - ComputeTracheaCentroidsAboveCarina(); - ComputeBronchusExtremaPointsBelowCarina(); - */ + // Extract Station3P + StartNewStep("Station 3P"); + StartSubStep(); + ExtractStation_3P(); + StopSubStep(); if (0) { // temporary suppress // Extract Station7 @@ -149,23 +143,91 @@ GenerateData() { //-------------------------------------------------------------------- template -void +bool clitk::ExtractLymphStationsFilter:: -ExtractStation_8() { +CheckForStation(std::string station) +{ + // Compute Station name + std::string s = "Station"+station; + - // Check if m_ListOfStations["8"] exist. If yes -> use it as initial - // support instead of m_Mediastinum - if (m_ListOfStations["8"]) { - DD("Station 8 support already exist -> use it"); - m_Working_Support = m_ListOfStations["8"]; + // Check if station already exist in DB + bool found = false; + if (GetAFDB()->TagExist(s)) { + m_ListOfStations[station] = GetAFDB()->template GetImage(s); + found = true; } - else m_Working_Support = m_Mediastinum; - ExtractStation_8_SI_Limits(); - ExtractStation_8_Post_Limits(); - ExtractStation_8_Ant_Limits(); - ExtractStation_8_LR_Limits(); - // ExtractStation_8_LR_Limits(); + // Define the starting support + if (found && GetComputeStation("8")) { + std::cout << "Station " << station << " already exists, but re-computation forced." << std::endl; + } + if (!found || GetComputeStation("8")) { + m_Working_Support = m_Mediastinum = GetAFDB()->template GetImage("Mediastinum", true); + return true; + } + else { + std::cout << "Station " << station << " found. I used it" << std::endl; + return false; + } +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +bool +clitk::ExtractLymphStationsFilter:: +GetComputeStation(std::string station) +{ + return (m_ComputeStationMap.find(station) != m_ComputeStationMap.end()); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void +clitk::ExtractLymphStationsFilter:: +AddComputeStation(std::string station) +{ + m_ComputeStationMap[station] = true; +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void +clitk::ExtractLymphStationsFilter:: +ExtractStation_8() +{ + if (CheckForStation("8")) { + ExtractStation_8_SI_Limits(); + ExtractStation_8_Post_Limits(); + ExtractStation_8_Ant_Limits(); + ExtractStation_8_LR_Limits(); + // Store image filenames into AFDB + writeImage(m_ListOfStations["8"], "seg/Station8.mhd"); + GetAFDB()->SetImageFilename("Station8", "seg/Station8.mhd"); + WriteAFDB(); + } +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void +clitk::ExtractLymphStationsFilter:: +ExtractStation_3P() +{ + if (CheckForStation("3P")) { + ExtractStation_3P_SI_Limits(); + // Store image filenames into AFDB + writeImage(m_ListOfStations["3P"], "seg/Station3P.mhd"); + GetAFDB()->SetImageFilename("Station3P", "seg/Station3P.mhd"); + } } //-------------------------------------------------------------------- @@ -202,6 +264,9 @@ ExtractStation_4RL() { //-------------------------------------------------------------------- +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template void