From dd629343e9209aa7a536b205f390f59f00247049 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Mon, 4 Oct 2010 08:03:04 +0000 Subject: [PATCH] now dump anatomical info (carina position) into a DB --- segmentation/clitkExtractAirwayTreeInfo.cxx | 9 +++++---- segmentation/clitkExtractAirwayTreeInfoFilter.h | 2 ++ segmentation/clitkExtractAirwayTreeInfoFilter.txx | 15 +++++++-------- .../clitkExtractAirwayTreeInfoGenericFilter.txx | 8 -------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/segmentation/clitkExtractAirwayTreeInfo.cxx b/segmentation/clitkExtractAirwayTreeInfo.cxx index e5a60c4..293dd45 100644 --- a/segmentation/clitkExtractAirwayTreeInfo.cxx +++ b/segmentation/clitkExtractAirwayTreeInfo.cxx @@ -33,10 +33,11 @@ int main(int argc, char * argv[]) FilterType::Pointer filter = FilterType::New(); filter->SetArgsInfo(args_info); - filter->Update(); - - if (filter->HasError()) { - std::cout << filter->GetLastError() << std::endl; + + try { + filter->Update(); + } catch(std::runtime_error e) { + std::cout << e.what() << std::endl; } return EXIT_SUCCESS; diff --git a/segmentation/clitkExtractAirwayTreeInfoFilter.h b/segmentation/clitkExtractAirwayTreeInfoFilter.h index f537311..8d1e5ee 100644 --- a/segmentation/clitkExtractAirwayTreeInfoFilter.h +++ b/segmentation/clitkExtractAirwayTreeInfoFilter.h @@ -108,6 +108,7 @@ namespace clitk { // Get results itkGetConstMacro(FirstTracheaPoint, ImagePointType); + itkGetConstMacro(CarinaPoint, ImagePointType); protected: ExtractAirwayTreeInfoFilter(); @@ -126,6 +127,7 @@ namespace clitk { // Results ImagePointType m_FirstTracheaPoint; + ImagePointType m_CarinaPoint; virtual void GenerateOutputInformation(); virtual void GenerateData(); diff --git a/segmentation/clitkExtractAirwayTreeInfoFilter.txx b/segmentation/clitkExtractAirwayTreeInfoFilter.txx index ba99b3d..8b9a557 100644 --- a/segmentation/clitkExtractAirwayTreeInfoFilter.txx +++ b/segmentation/clitkExtractAirwayTreeInfoFilter.txx @@ -87,7 +87,7 @@ GenerateOutputInformation() // Get input pointer input = dynamic_cast(itk::ProcessObject::GetInput(0)); - StartNewStepOrStop("Find bronchial bifurcations"); + StartNewStep("Find bronchial bifurcations"); // Step 1 : extract skeleton // Define the thinning filter typedef itk::BinaryThinningImageFilter3D ThinningFilterType; @@ -108,7 +108,7 @@ GenerateOutputInformation() --it; } if (it.IsAtEnd()) { - this->SetLastError("ERROR: first point in the skeleton not found ! Abort"); + throw clitk::ExceptionObject("ERROR: first point in the skeleton not found ! Abort"); return; } DD(skeleton->GetLargestPossibleRegion().GetIndex()); @@ -142,7 +142,11 @@ GenerateOutputInformation() skeleton->TransformIndexToPhysicalPoint(listOfBifurcations[i].index, p); DD(p); } - + + // The first bifurcation is supposed to be the carina + skeleton->TransformIndexToPhysicalPoint(listOfBifurcations[0].index, m_CarinaPoint); + DD(listOfBifurcations[0].index); + DD(m_CarinaPoint); } //-------------------------------------------------------------------- @@ -153,11 +157,6 @@ void clitk::ExtractAirwayTreeInfoFilter:: GenerateData() { - // Do not put some "startnewstep" here, because the object if - // modified and the filter's pipeline it do two times. But it is - // required to quit if MustStop was set before. - if (GetMustStop()) return; - // If everything goes well, set the output this->GraftOutput(skeleton); // not SetNthOutput } diff --git a/segmentation/clitkExtractAirwayTreeInfoGenericFilter.txx b/segmentation/clitkExtractAirwayTreeInfoGenericFilter.txx index 47511e4..4b42b19 100644 --- a/segmentation/clitkExtractAirwayTreeInfoGenericFilter.txx +++ b/segmentation/clitkExtractAirwayTreeInfoGenericFilter.txx @@ -77,19 +77,11 @@ void clitk::ExtractAirwayTreeInfoGenericFilter::UpdateWithInputIma this->SetFilterBase(filter); // Set global Options - filter->SetStopOnError(this->GetStopOnError()); filter->SetArgsInfo(mArgsInfo); filter->SetInput(input); // Go ! filter->Update(); - - // Check if error - if (filter->HasError()) { - SetLastError(filter->GetLastError()); - // No output - return; - } // Write/Save results typename ImageType::Pointer output = filter->GetOutput(); -- 2.47.1