X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLungFilter.txx;h=3a098e9aad5c84bbbe965995ef7200ee974368ab;hb=615a1af31ba4649c58c684b006b696536e7d8ef5;hp=32d480c3395bc3f7cf36cf2c83eb175e1d63d353;hpb=a339bdc482ea9752ec53195bc9a47e8b05dba582;p=clitk.git diff --git a/segmentation/clitkExtractLungFilter.txx b/segmentation/clitkExtractLungFilter.txx index 32d480c..3a098e9 100644 --- a/segmentation/clitkExtractLungFilter.txx +++ b/segmentation/clitkExtractLungFilter.txx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef CLITKEXTRACTLUNGSFILTER_TXX #define CLITKEXTRACTLUNGSFILTER_TXX @@ -96,6 +96,7 @@ ExtractLungFilter(): // Step 6 FillHolesFlagOn(); + AutoCropOn(); } //-------------------------------------------------------------------- @@ -311,7 +312,8 @@ GenerateOutputInformation() //-------------------------------------------------------------------- PrintMemory(GetVerboseMemoryFlag(), "before autocropfilter"); if (m_Seeds.size() != 0) { // if ==0 ->no trachea found - trachea = clitk::AutoCrop(trachea, GetBackgroundValue()); + if (GetAutoCrop()) + trachea = clitk::AutoCrop(trachea, GetBackgroundValue()); StopCurrentStep(trachea); PrintMemory(GetVerboseMemoryFlag(), "after delete trachea"); } @@ -321,7 +323,8 @@ GenerateOutputInformation() //-------------------------------------------------------------------- StartNewStep("Cropping lung"); PrintMemory(GetVerboseMemoryFlag(), "Before Autocropfilter"); - working_mask = clitk::AutoCrop(working_mask, GetBackgroundValue()); + if (GetAutoCrop()) + working_mask = clitk::AutoCrop(working_mask, GetBackgroundValue()); StopCurrentStep(working_mask); //-------------------------------------------------------------------- @@ -588,7 +591,7 @@ ComputeTracheaVolume() //-------------------------------------------------------------------- template -void +void clitk::ExtractLungFilter:: SearchForTrachea() { @@ -603,8 +606,8 @@ SearchForTrachea() double volume = 0.0; int skip = GetNumberOfSlicesToSkipBeforeSearchingSeed(); while (!stop) { - stop = SearchForTracheaSeed(skip); - if (stop) { + stop = true; + if (SearchForTracheaSeed(skip)) { TracheaRegionGrowing(); volume = ComputeTracheaVolume()/1000; // assume mm3, so divide by 1000 to get cc if (GetWriteStepFlag()) { @@ -616,7 +619,6 @@ SearchForTrachea() if (GetVerboseStepFlag()) { std::cout << "\t Found trachea with volume " << volume << " cc." << std::endl; } - stop = true; } else { if (GetVerboseStepFlag()) { @@ -629,6 +631,11 @@ SearchForTrachea() // empty the list of seed m_Seeds.clear(); } + if (skip > 0.5 * working_input->GetLargestPossibleRegion().GetSize()[2]) { + // we want to skip more than a half of the image, it is probably a bug + std::cerr << "2 : Number of slices to skip to find trachea too high = " << skip << std::endl; + stop = true; + } } else { stop = true;