#include <tuple>
#include <fpa_ctbronchi_export.h>
#include "Image.h"
+#include "Skeleton.h"
namespace CTBronchi
{
typedef short TPixel;
typedef unsigned char TLabel;
typedef float TScalar;
+ typedef std::string TString;
// Arguments
- typedef std::tuple< std::string, bool > TArgument;
- typedef std::map< std::string, TArgument > TArguments;
+ typedef std::tuple< TString, TString, bool > TStrArg;
+ typedef std::tuple< TScalar, TString, bool > TDblArg;
+ typedef std::map< TString, TStrArg > TStrArgs;
+ typedef std::map< TString, TDblArg > TDblArgs;
// Images
typedef CTBronchi::Image< TPixel, Dim > TPixelImage;
typedef CTBronchi::Image< TLabel, Dim > TLabelImage;
typedef CTBronchi::Image< TScalar, Dim > TScalarImage;
+ // Skeleton
+ typedef CTBronchi::Skeleton< Dim > TSkeleton;
+
// Seed
typedef TPixelImage::TImage::PointType TPoint;
typedef TPixelImage::TImage::IndexType TIndex;
void Update( );
protected:
- void _Input( );
- void _Vesselness( );
- void _Mori( );
- void _MoriLabelling( );
+ template< class _TImage >
+ void _Input( _TImage& input );
+
+ template< class _TInput, class _TVesselness >
+ void _Vesselness( _TInput& input, _TVesselness& vesselness );
+
+ template< class _TInput, class _TMori, class _TSeed >
+ void _Mori( _TInput& input, _TMori& mori, _TSeed& seed );
+
+ template< class _TInput, class _TMori, class _TVesselness, class _TLabels >
+ void _MoriLabelling(
+ _TInput& input, _TMori& mori, _TVesselness& vesselness, _TLabels& labels
+ );
+
+ template< class _TInput, class _TLabels, class _TFastRW >
+ void _FastRW( _TInput& input, _TLabels& labels, _TFastRW& fastrw );
+
+ template< class _TInput, class _TLabels, class _TVesselness, class _TSliceRW >
+ void _SliceRW(
+ _TInput& input, _TLabels& labels, _TVesselness& vesselness, _TSliceRW& slicerw
+ );
+
+ template< class _TInput >
+ void _AndImages( _TInput& a, _TInput& b, _TInput& c );
+
+ template< class _TInput, class _TSkeleton >
+ void _Skeleton( _TInput& a, _TSkeleton& s, const TString& fname );
protected:
- TArguments m_StrArg;
- TArguments m_DblArg;
+ TStrArgs m_StrArgs;
+ TDblArgs m_DblArgs;
- std::string m_BaseFileName;
- TSeed m_Seed;
+ TSeed m_Seed;
TLabel m_UndefinedLabel;
TLabel m_InsideLabel;
TLabel m_OutsideLabel;
TLabelImage m_Labels;
TLabelImage m_FastRW;
TLabelImage m_SliceRW;
+ TLabelImage m_AndRW;
+
+ TSkeleton m_FastRWSkeleton;
+ TSkeleton m_SliceRWSkeleton;
+ TSkeleton m_AndRWSkeleton;
};
} // ecapseman
-/* TODO
- #include <string>
- #include <tclap/CmdLine.h>
- #include <itkImage.h>
- #include <itkMinimumMaximumImageCalculator.h>
- #include <itkInvertIntensityImageFilter.h>
- #include <itkHessianRecursiveGaussianImageFilter.h>
- #include <itkHessian3DToVesselnessMeasureImageFilter.h>
- #include "Functions.h"
-
- // -------------------------------------------------------------------------
- const unsigned int Dim = 3;
- typedef short TPixel;
- typedef itk::NumericTraits< TPixel >::RealType TScalar;
- typedef itk::Image< TPixel, Dim > TImage;
- typedef itk::Image< TScalar, Dim > TScalarImage;
-
- // -------------------------------------------------------------------------
- int main( int argc, char* argv[] )
- {
- typedef TCLAP::ValueArg< std::string > _TStringArg;
- typedef TCLAP::ValueArg< TScalar > _TRealArg;
-
- // Parse input line
- _TStringArg in( "i", "input", "Input image", true, "", "file" );
- _TStringArg out( "o", "output", "Output image", true, "", "file" );
- _TRealArg s( "s", "sigma", "Sigma", false, 0.5, "value (0.5)" );
- _TRealArg a1( "a", "alpha1", "Alpha1", false, 0.5, "value (0.5)" );
- _TRealArg a2( "b", "alpha2", "Alpha2", false, 2, "value (2)" );
- try
- {
- TCLAP::CmdLine cmd( "Vesselness computation", ' ', "1.0.0" );
- cmd.add( a2 );
- cmd.add( a1 );
- cmd.add( s );
- cmd.add( out );
- cmd.add( in );
- cmd.parse( argc, argv );
- }
- catch( TCLAP::ArgException& err )
- {
- std::cerr
- << "===============================" << std::endl
- << "Error caught: " << std::endl
- << err.error( ) << " " << err.argId( )
- << "===============================" << std::endl
- << std::endl;
- return( 1 );
-
- } // yrt
-
- try
- {
- // Read image
- TImage::Pointer input_image;
- CTBronchi::ReadImage( input_image, in.getValue( ) );
-
- // Min-max
- typedef itk::MinimumMaximumImageCalculator< TImage > _TMinMax;
- _TMinMax::Pointer minMax = _TMinMax::New( );
- minMax->SetImage( input_image );
- minMax->Compute( );
-
- // Invert intensities
- typedef itk::InvertIntensityImageFilter< TImage > _TInverter;
- _TInverter::Pointer inverter = _TInverter::New( );
- inverter->SetInput( input_image );
- inverter->SetMaximum( minMax->GetMaximum( ) );
- double t = CTBronchi::MeasureTime( inverter );
- std::cout << "Inversion executed in " << t << " s" << std::endl;
-
- // Compute hessian image
- typedef itk::HessianRecursiveGaussianImageFilter< TImage > _THessian;
- _THessian::Pointer hessian = _THessian::New( );
- hessian->SetInput( inverter->GetOutput( ) );
- hessian->SetSigma( s.getValue( ) );
- t = CTBronchi::MeasureTime( hessian );
- std::cout << "Hessian executed in " << t << " s" << std::endl;
-
- // Vesselness
- typedef
- itk::Hessian3DToVesselnessMeasureImageFilter< TScalar >
- _TVesselness;
- _TVesselness::Pointer vesselness = _TVesselness::New( );
- vesselness->SetInput( hessian->GetOutput( ) );
- vesselness->SetAlpha1( a1.getValue( ) );
- vesselness->SetAlpha2( a2.getValue( ) );
- t = CTBronchi::MeasureTime( vesselness );
- std::cout << "Vesselness executed in " << t << " s" << std::endl;
-
- // Write result
- CTBronchi::WriteImage( vesselness->GetOutput( ), out.getValue( ) );
- }
- catch( std::exception& err )
- {
- std::cerr
- << "===============================" << std::endl
- << "Error caught: " << std::endl
- << err.what( )
- << "===============================" << std::endl
- << std::endl;
- return( 1 );
-
- } // yrt
- return( 0 );
- }
-*/
#endif // __CTBronchi__Process__h__
// eof - $RCSfile$