//--------------------------------------------------------------------
template <class ImageType>
-void
+void
clitk::ExtractLungFilter<ImageType>::
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()) {
if (GetVerboseStepFlag()) {
std::cout << "\t Found trachea with volume " << volume << " cc." << std::endl;
}
- stop = true;
}
else {
if (GetVerboseStepFlag()) {
// 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;