--- /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)
+//=====
+#include "bbitkDetectTubularStructuresInImage.h"
+#include "bbitkPackage.h"
+namespace bbitk
+{
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(itk,DetectTubularStructuresInImage)
+ BBTK_BLACK_BOX_IMPLEMENTATION(DetectTubularStructuresInImage,bbtk::AtomicBlackBox);
+} // EO namespace bbitk
+
+
--- /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__
+
#include "itkRescaleIntensityImageFilter.h"
#include "itkMinimumMaximumImageCalculator.h"
-
#include <iostream>
#include <string>
-
namespace bbitk
{
private :
inline void ProcessSwitch();
template <class T> void Process();
-
//=====
// 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)
//=====
correlationFilter->SetMovingImage( in2 );
correlationFilter->Update();
-
using RescaleFilterType = itk::RescaleIntensityImageFilter<FloatImageType, ImageType>;
auto rescaleFilter = RescaleFilterType::New();
rescaleFilter->SetInput(correlationFilter->GetOutput());
this->bbSetOutputOut( minimumMaximumImageCalculatorFilter->GetMaximum() );
printf("EED NormalizedCorrelationImageToImageMetric::Process End \n");
-
}
//-----------------------------------------------------------------
LPR = in->GetLargestPossibleRegion();
size = LPR.GetSize();
// origin = LPR.GetIndex(); //in->GetOrigin();
- for (unsigned int i=0;i<Dimension;++i)
- {
+ for (unsigned int i=0;i<Dimension;++i)
+ {
origin[i] = LPR.GetIndex()[i]*in->GetSpacing()[i];
spacing[i] = bbGetInputSpacing()[i];
double tmp = (LPR.GetSize()[i]*in->GetSpacing()[i]/spacing[i] ) + 0.5;
--- /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)
+//=====
+#include "bbitkTubularStructures_Frangi.h"
+#include "bbitkPackage.h"
+namespace bbitk
+{
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(itk,TubularStructures_Frangi)
+ BBTK_BLACK_BOX_IMPLEMENTATION(TubularStructures_Frangi,bbtk::AtomicBlackBox);
+} // EO namespace bbitk
+
+
--- /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 __bbitkTubularStructures_Frangi_h_INCLUDED__
+#define __bbitkTubularStructures_Frangi_h_INCLUDED__
+
+#include "bbitk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "itkImage.h"
+//#include "itkImageFileReader.h"
+//#include "itkImageFileWriter.h"
+#include "itkExtractImageFilter.h"
+
+#include "itkHessianToObjectnessMeasureImageFilter.h"
+#include "itkMultiScaleHessianBasedMeasureImageFilter.h"
+#include "itkRescaleIntensityImageFilter.h"
+
+#include "bbitkImage.h"
+
+namespace bbitk
+{
+
+class bbitk_EXPORT TubularStructures_Frangi
+:
+public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(TubularStructures_Frangi,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);
+
+ // 3 - alpha
+ // 4 - beta
+ // 5 - gamma
+ // 6 - sigmaMinimum
+ // 7 - sigmaMaximum
+ // 8 - numberOfSigmaSteps
+ BBTK_DECLARE_INPUT(Alpha,double);
+ BBTK_DECLARE_INPUT(Beta,double);
+ BBTK_DECLARE_INPUT(Gamma,double);
+ BBTK_DECLARE_INPUT(SigmaMinimum,double);
+ BBTK_DECLARE_INPUT(SigmaMaximum,double);
+ BBTK_DECLARE_INPUT(NumberOfSigmaSteps,int);
+
+ 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(TubularStructures_Frangi,bbtk::AtomicBlackBox);
+ BBTK_NAME("TubularStructures_Frangi");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(TubularStructures_Frangi,In,"First input in DOUBLE format",anyImagePointer,"");
+ BBTK_INPUT(TubularStructures_Frangi,Alpha,"(default 0.8) Alpha",double,"");
+ BBTK_INPUT(TubularStructures_Frangi,Beta,"(default 1) Beta",double,"");
+ BBTK_INPUT(TubularStructures_Frangi,Gamma,"(default 250) Gamma",double,"");
+ BBTK_INPUT(TubularStructures_Frangi,SigmaMinimum,"(default 0.5) SigmaMinimum",double,"");
+ BBTK_INPUT(TubularStructures_Frangi,SigmaMaximum,"(default 12) SigmaMaximum",double,"");
+ BBTK_INPUT(TubularStructures_Frangi,NumberOfSigmaSteps,"(default 11) NumberOfSigmaSteps",int,"");
+ BBTK_OUTPUT(TubularStructures_Frangi,Out,"First output in DOUBLE format",anyImagePointer,"");
+BBTK_END_DESCRIBE_BLACK_BOX(TubularStructures_Frangi);
+
+//===================================================
+void TubularStructures_Frangi::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 TubularStructures_Frangi::Process()
+{
+ printf("EED TubularStructures_Frangi::Process Start\n");
+
+// std::cout << "Starting Hessian filter" << std::endl;
+
+// if (argc > 9){
+// std::cout << "too many arguments" << std::endl;
+// return EXIT_FAILURE;
+// }
+
+ // setting up arguments
+// std::string filename, filetype;
+ float alpha, beta, gamma;
+ double sigmaMinimum, sigmaMaximum;
+ unsigned int numberOfSigmaSteps;
+ // constexpr, computation at compile time
+ constexpr unsigned int Dimension = 3;
+ constexpr float desiredMinimum = 0.0;
+ constexpr float desiredMaximum = 255.0;
+
+// if (argc == 9){
+// filename = argv[1];
+// filetype = argv[2];
+// alpha = std::stof(argv[3]);
+// beta = std::stof(argv[4]);
+// gamma = std::stof(argv[5]);
+// sigmaMinimum = std::atof(argv[6]);
+// sigmaMaximum = std::atof(argv[7]);
+// numberOfSigmaSteps = atoi(argv[8]);
+// } else {
+// std::cout << "Not enough arguments, went with default" << std::endl;
+// filename = "Smallfield_OCT_Angiography_Volume_fovea"; //filename in data/
+// filetype = ".nii";
+// alpha = 0.8;
+// beta = 1;
+// gamma = 250;
+// sigmaMinimum = 0.5;
+// sigmaMaximum = 12;
+// numberOfSigmaSteps = 11;
+// }
+
+ alpha = bbGetInputAlpha();
+ beta = bbGetInputBeta();
+ gamma = bbGetInputGamma();
+ sigmaMinimum = bbGetInputSigmaMinimum();
+ sigmaMaximum = bbGetInputSigmaMaximum();
+ numberOfSigmaSteps = bbGetInputNumberOfSigmaSteps();
+
+ //timing
+// auto start = std::chrono::high_resolution_clock::now();
+// std::string inputFileName = makeInputFileName(filename, filetype);
+// auto stop = std::chrono::high_resolution_clock::now();
+// auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds for reading in the file and creating constants"<<std::endl;
+
+// std::string outputFileName = makeOutputFileName(filename, filetype, alpha, beta, gamma, sigmaMinimum, sigmaMaximum, numberOfSigmaSteps);
+// std::cout << "Output filename is: "<< outputFileName << std::endl;
+
+ //Setting up the image reader of the particular type
+// using PixelType = float;
+ using PixelType = double;
+ using ImageType = itk::Image< PixelType, Dimension >;
+// using ReaderType = itk::ImageFileReader< ImageType >;
+
+ //Setting up the reader
+// ReaderType::Pointer reader = ReaderType::New();
+// reader->SetFileName( inputFileName );
+// reader->Update();
+
+// stop = std::chrono::high_resolution_clock::now();
+// duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds for setting image and reader"<<std::endl;
+
+// ImageType::Pointer image = reader->GetOutput();
+// ImageType::RegionType region = image->GetLargestPossibleRegion();
+
+ T* inputImage = this->bbGetInputIn().get<T*>();
+ // ImageType::RegionType region = image->GetLargestPossibleRegion();
+ ImageType::RegionType region = inputImage->GetLargestPossibleRegion();
+ ImageType::SizeType size = region.GetSize();
+
+ using HessianPixelType = itk::SymmetricSecondRankTensor< float, Dimension >;
+ using HessianImageType = itk::Image< HessianPixelType, Dimension >;
+ using ObjectnessFilterType = itk::HessianToObjectnessMeasureImageFilter< HessianImageType, ImageType >;
+ ObjectnessFilterType::Pointer objectnessFilter = ObjectnessFilterType::New();
+ objectnessFilter->SetBrightObject( true );
+ objectnessFilter->SetScaleObjectnessMeasure( false );
+ objectnessFilter->SetAlpha( alpha );
+ objectnessFilter->SetBeta( beta );
+ objectnessFilter->SetGamma( gamma );
+
+// stop = std::chrono::high_resolution_clock::now();
+// duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds for setting Hessian output image"<<std::endl;
+
+ using MultiScaleEnhancementFilterType = itk::MultiScaleHessianBasedMeasureImageFilter< ImageType, HessianImageType, ImageType >;
+ MultiScaleEnhancementFilterType::Pointer multiScaleEnhancementFilter = MultiScaleEnhancementFilterType::New();
+
+// multiScaleEnhancementFilter->SetInput( reader->GetOutput() );
+ multiScaleEnhancementFilter->SetInput( inputImage );
+
+ multiScaleEnhancementFilter->SetHessianToMeasureFilter( objectnessFilter );
+ multiScaleEnhancementFilter->SetSigmaStepMethodToLogarithmic();
+ multiScaleEnhancementFilter->SetSigmaMinimum( sigmaMinimum );
+ multiScaleEnhancementFilter->SetSigmaMaximum( sigmaMaximum );
+ multiScaleEnhancementFilter->SetNumberOfSigmaSteps( numberOfSigmaSteps );
+
+// stop = std::chrono::high_resolution_clock::now();
+// duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds for setting up the Hessian filter" <<std::endl;
+
+ //
+// using OutputImageType = itk::Image< float, Dimension >;
+// using RescaleFilterType = itk::RescaleIntensityImageFilter< ImageType, OutputImageType >;
+// RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();
+// rescaleFilter->SetInput( multiScaleEnhancementFilter->GetOutput() );
+
+ //rescale to 0 and 255 for output
+// rescaleFilter->SetOutputMinimum(desiredMinimum);
+// rescaleFilter->SetOutputMaximum(desiredMaximum);
+
+// stop = std::chrono::high_resolution_clock::now();
+// duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds for setting min max intensity"<< std::endl;
+
+ //Setting up the output writer
+// using WriterType = itk::ImageFileWriter< OutputImageType >;//setting up type for writer
+// WriterType::Pointer writer = WriterType::New();//initialize new writer pointer
+// writer->SetFileName( outputFileName );//set filename for writer
+// writer->SetInput( rescaleFilter->GetOutput() );//
+//writer->SetUseCompression( true );
+
+// stop = std::chrono::high_resolution_clock::now();
+// duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds for setting up writer" << std::endl;
+
+
+ //Write to file
+// try {
+// writer->Update();
+// } catch ( itk::ExceptionObject & error ){
+// std::cerr << "Error: " << error << std::endl;
+// return EXIT_FAILURE;
+// }
+
+// stop = std::chrono::high_resolution_clock::now();
+// duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
+// std::cout << duration.count() << " milliseconds when " << outputFileName << " written out succesfully" << std::endl;
+// return EXIT_SUCCESS;
+
+ multiScaleEnhancementFilter->Update();
+ multiScaleEnhancementFilter->GetOutput()->Register();
+ if (mOutput) mOutput->UnRegister();
+ this->bbSetOutputOut( multiScaleEnhancementFilter->GetOutput() );
+ mOutput = multiScaleEnhancementFilter->GetOutput();
+
+ printf("EED TubularStructures_Frangi::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 TubularStructures_Frangi::bbUserSetDefaultValues()
+{
+ bbSetInputAlpha( 0.8 );
+ bbSetInputBeta( 1 );
+ bbSetInputGamma( 250 );
+ bbSetInputSigmaMinimum( 0.5 );
+ bbSetInputSigmaMaximum( 12 );
+ bbSetInputNumberOfSigmaSteps( 11 );
+}
+
+//=====
+// 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 TubularStructures_Frangi::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 TubularStructures_Frangi::bbUserFinalizeProcessing()
+{
+}
+
+}// EO namespace bbitk
+#endif // __bbitkTubularStructures_Frangi_h_INCLUDED__
+
--- /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)
+//=====
+#include "bbitkTubularStructures_Sato.h"
+#include "bbitkPackage.h"
+namespace bbitk
+{
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(itk,TubularStructures_Sato)
+ BBTK_BLACK_BOX_IMPLEMENTATION(TubularStructures_Sato,bbtk::AtomicBlackBox);
+} // EO namespace bbitk
+
+
--- /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 __bbitkTubularStructures_Sato_h_INCLUDED__
+#define __bbitkTubularStructures_Sato_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 TubularStructures_Sato
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(TubularStructures_Sato,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(TubularStructures_Sato,bbtk::AtomicBlackBox);
+ BBTK_NAME("TubularStructures_Sato");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(TubularStructures_Sato,In,"Input image in DOUBLE format",anyImagePointer,"");
+ BBTK_INPUT(TubularStructures_Sato,Sigma,"(default 1) hessianFilter Sigma",double,"");
+ BBTK_INPUT(TubularStructures_Sato,Alpha1,"(default 0.5) vesselnessFilter Alpha1",double,"");
+ BBTK_INPUT(TubularStructures_Sato,Alpha2,"(default 2.0) vesselnessFilter Alpha2",double,"");
+ BBTK_OUTPUT(TubularStructures_Sato,Out,"Output image in FLOAT format",anyImagePointer,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(TubularStructures_Sato);
+//=====
+// 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 TubularStructures_Sato::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 TubularStructures_Sato::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 TubularStructures_Sato::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 TubularStructures_Sato::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 TubularStructures_Sato::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 TubularStructures_Sato::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 TubularStructures_Sato::bbUserFinalizeProcessing()
+{
+}
+
+}// EO namespace bbitk
+#endif // __bbitkTubularStructures_Sato_h_INCLUDED__
+
bbSetOutputOut(result);
}
-
//--------------------------------------------------------------------------------------------
void TemporalPicker::Process_TemporaryPicker2DT()
{
sizeY=ext[3]-ext[2]+1;
sizeZ=ext[5]-ext[4]+1;
-
if (bbGetInputPoint().size()>=2)
{
int px=bbGetInputPoint()[0];
void TemporalPicker::Process()
{
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// (the one provided in the attribute 'name' of the tag 'input')
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
-
-
if (bbGetInputInLst().size()>0)
{
Process_TemporaryPicker3DT();
} else {
Process_TemporaryPicker2DT();
}
-
}
-//=====
+
+//=====
// 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 TemporalPicker::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputIn(NULL);
bbSetInputSizeRegion(1);
-
}
-//=====
+
+//=====
// 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 TemporalPicker::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
-
+// if any
}
-//=====
+
+//=====
// 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 TemporalPicker::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
-}
-// EO namespace bbvtk
+
+}// EO namespace bbvtk
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
-
#include "bbvtkUnaryOperations.h"
#include "bbvtkPackage.h"
namespace bbvtk
{
-
BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,UnaryOperations)
BBTK_BLACK_BOX_IMPLEMENTATION(UnaryOperations,bbtk::AtomicBlackBox);
void UnaryOperations::Process()
ope->SetInput1Data((vtkDataObject*)bbGetInputIn1());
#endif
-
switch (bbGetInputOperation())
{
case 0:
ope->SetConstantK( bbGetInputNewValue() );
ope->SetOperationToReplaceCByK();
break;
-
-
-
-
+
default:
std::cout << "Invalid Operation" << std::endl;
return;
#include "bbtkAtomicBlackBox.h"
#include "iostream"
-
#include "vtkVersion.h"
#include <vtkImageMathematics.h>
#include <vtkImageData.h>
#include <vtkImageData.h>
#include <bbtkStaticLecture.h>
-
namespace bbvtk
{
-
-
-
-
class bbvtk_EXPORT UnaryOperations
:
public bbtk::AtomicBlackBox