From: eduardo.davila@creatis.insa-lyon.fr Date: Fri, 6 Feb 2026 12:40:44 +0000 (+0100) Subject: Clean code X-Git-Url: http://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=241b941e99e490e077c0f2fb52f39028a9c7f65a;p=bbtk.git Clean code --- diff --git a/packages/itk/src/bbitkDetectTubularStructuresInImage.cxx b/packages/itk/src/bbitkDetectTubularStructuresInImage.cxx deleted file mode 100644 index 98db8c3..0000000 --- a/packages/itk/src/bbitkDetectTubularStructuresInImage.cxx +++ /dev/null @@ -1,12 +0,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) -//===== -#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 - - diff --git a/packages/itk/src/bbitkDetectTubularStructuresInImage.h b/packages/itk/src/bbitkDetectTubularStructuresInImage.h deleted file mode 100644 index fc05753..0000000 --- a/packages/itk/src/bbitkDetectTubularStructuresInImage.h +++ /dev/null @@ -1,135 +0,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) -//===== -#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 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 -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; - using HessianFilterType = itk::HessianRecursiveGaussianImageFilter; - using VesselnessMeasureFilterType = itk::Hessian3DToVesselnessMeasureImageFilter; - auto hessianFilter = HessianFilterType::New(); - auto vesselnessFilter = VesselnessMeasureFilterType::New(); - T* inputImage = this->bbGetInputIn().get(); - hessianFilter->SetInput( inputImage ); - hessianFilter->SetSigma(static_cast( bbGetInputSigma() )); - vesselnessFilter->SetInput(hessianFilter->GetOutput()); - vesselnessFilter->SetAlpha1(static_cast( bbGetInputAlpha1() )); - vesselnessFilter->SetAlpha2(static_cast( 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__ -