+++ /dev/null
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-#ifndef __bbitkDetectTubularStructuresInImage_h_INCLUDED__
-#define __bbitkDetectTubularStructuresInImage_h_INCLUDED__
-
-#include "bbitk_EXPORT.h"
-#include "bbtkAtomicBlackBox.h"
-#include "iostream"
-
-#include "itkHessian3DToVesselnessMeasureImageFilter.h"
-#include "itkHessianRecursiveGaussianImageFilter.h"
-
-#include "bbitkImage.h"
-
-namespace bbitk
-{
-
-class bbitk_EXPORT DetectTubularStructuresInImage
- :
- public bbtk::AtomicBlackBox
-{
- BBTK_BLACK_BOX_INTERFACE(DetectTubularStructuresInImage,bbtk::AtomicBlackBox);
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
- BBTK_DECLARE_INPUT(In,anyImagePointer);
- BBTK_DECLARE_INPUT(Sigma,double);
- BBTK_DECLARE_INPUT(Alpha1,double);
- BBTK_DECLARE_INPUT(Alpha2,double);
- BBTK_DECLARE_OUTPUT(Out,anyImagePointer);
- BBTK_PROCESS(ProcessSwitch);
-
- private :
- inline void ProcessSwitch();
- template <class T> void Process();
- itk::Object* mOutput;
-
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-};
-
-BBTK_BEGIN_DESCRIBE_BLACK_BOX(DetectTubularStructuresInImage,bbtk::AtomicBlackBox);
- BBTK_NAME("DetectTubularStructuresInImage");
- BBTK_AUTHOR("InfoDev");
- BBTK_DESCRIPTION("detect bright tubular structures in the image");
- BBTK_CATEGORY("empty");
- BBTK_INPUT(DetectTubularStructuresInImage,In,"Input image",anyImagePointer,"");
- BBTK_INPUT(DetectTubularStructuresInImage,Sigma,"(default 1) hessianFilter Sigma",double,"");
- BBTK_INPUT(DetectTubularStructuresInImage,Alpha1,"(default 0.5) vesselnessFilter Alpha1",double,"");
- BBTK_INPUT(DetectTubularStructuresInImage,Alpha2,"(default 2.0) vesselnessFilter Alpha2",double,"");
- BBTK_OUTPUT(DetectTubularStructuresInImage,Out,"Output image",anyImagePointer,"");
-BBTK_END_DESCRIBE_BLACK_BOX(DetectTubularStructuresInImage);
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-
-//===================================================
-void DetectTubularStructuresInImage::ProcessSwitch()
-{
- bbtk::TypeInfo t = bbGetInputIn().type();
-// BBTK_TEMPLATE_ITK_IMAGE_SWITCH(t, this->Process);
-// BBTK_TEMPLATE_ITK_IMAGE_DIM_3_SWITCH(t, this->Process , "Error format. (you need 3D short,float,double)") ;
-
- BBTK_BEGIN_TEMPLATE_SWITCH(t)
-// BBTK_SWITCH_ITK_IMAGE_short_3(t,this->Process,)
-// BBTK_SWITCH_ITK_IMAGE_float_3(t,this->Process,)
- BBTK_SWITCH_ITK_IMAGE_double_3(t,this->Process,)
- BBTK_END_TEMPLATE_SWITCH(t)
-}
-
-
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-template <class T>
-void DetectTubularStructuresInImage::Process()
-{
- // https://docs.itk.org/projects/doxygen/en/stable/Examples_2Filtering_2VesselnessMeasureImageFilter_8cxx-example.html
- // https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1HessianRecursiveGaussianImageFilter.html
- // https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1Hessian3DToVesselnessMeasureImageFilter.html
- // http://www.image.med.osaka-u.ac.jp/member/yoshi/paper/linefilter.pdf
- printf("EED DetectTubularStructuresInImage::Process Start\n");
- constexpr unsigned int Dimension = 3;
- using InputPixelType = double;
- using OutputPixelType = float;
- using InputImageType = itk::Image<InputPixelType, Dimension>;
- using HessianFilterType = itk::HessianRecursiveGaussianImageFilter<InputImageType>;
- using VesselnessMeasureFilterType = itk::Hessian3DToVesselnessMeasureImageFilter<OutputPixelType>;
- auto hessianFilter = HessianFilterType::New();
- auto vesselnessFilter = VesselnessMeasureFilterType::New();
- T* inputImage = this->bbGetInputIn().get<T*>();
- hessianFilter->SetInput( inputImage );
- hessianFilter->SetSigma(static_cast<double>( bbGetInputSigma() ));
- vesselnessFilter->SetInput(hessianFilter->GetOutput());
- vesselnessFilter->SetAlpha1(static_cast<double>( bbGetInputAlpha1() ));
- vesselnessFilter->SetAlpha2(static_cast<double>( bbGetInputAlpha2() ));
- vesselnessFilter->Update();
- vesselnessFilter->GetOutput()->Register();
- if (mOutput) mOutput->UnRegister();
- this->bbSetOutputOut( vesselnessFilter->GetOutput() );
- mOutput = vesselnessFilter->GetOutput();
- printf("EED DetectTubularStructuresInImage::Process End\n");
-}
-
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-void DetectTubularStructuresInImage::bbUserSetDefaultValues()
-{
- mOutput = 0;
- bbSetInputSigma(1);
- bbSetInputAlpha1(0.5);
- bbSetInputAlpha2(2.0);
-}
-
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-void DetectTubularStructuresInImage::bbUserInitializeProcessing()
-{
-}
-
-//=====
-// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
-//=====
-void DetectTubularStructuresInImage::bbUserFinalizeProcessing()
-{
-}
-
-}// EO namespace bbitk
-
-#endif // __bbitkDetectTubularStructuresInImage_h_INCLUDED__
-