From: Presles Benoît Date: Tue, 16 Dec 2014 11:01:31 +0000 (+0100) Subject: the barycenter tool is the same as the image moment tool - so we delete it X-Git-Tag: v1.4.0~103 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c9ee0752280f0607a22dbaf3ffe40d4cc8042d37;p=clitk.git the barycenter tool is the same as the image moment tool - so we delete it --- diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 016b26a..6bd72a3 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -325,11 +325,6 @@ if(CLITK_BUILD_TOOLS) target_link_libraries(clitkBlurImage clitkCommon ) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkBlurImage) - WRAP_GGO(clitkImageBarycenter_GGO_C clitkImageBarycenter.ggo) - add_executable(clitkImageBarycenter clitkImageBarycenter.cxx ${clitkImageBarycenter_GGO_C}) - target_link_libraries(clitkImageBarycenter clitkCommon ) - set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkBlurImage) - #========================================================= option(CLITK_USE_ROOT "Build experimental tools using root" OFF) if (CLITK_USE_ROOT) diff --git a/tools/clitkImageBarycenter.cxx b/tools/clitkImageBarycenter.cxx deleted file mode 100644 index 03dea82..0000000 --- a/tools/clitkImageBarycenter.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -===========================================================================**/ - -/* ================================================= - * @file clitkImageBarycenterGenericFilter.txx - * @author xxx - * @date 29 June 2029 - * - * @brief ImageBarycenter an image - * - ===================================================*/ - -// clitk -#include "clitkImageBarycenter_ggo.h" -#include "clitkImageBarycenterGenericFilter.h" - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) -{ - - // Init command line - GGO(clitkImageBarycenter, args_info); - CLITK_INIT; - - // Filter - typedef clitk::ImageBarycenterGenericFilter FilterType; - FilterType::Pointer filter = FilterType::New(); - - filter->SetArgsInfo(args_info); - filter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkImageBarycenter.ggo b/tools/clitkImageBarycenter.ggo deleted file mode 100644 index b366eb9..0000000 --- a/tools/clitkImageBarycenter.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkImageBarycenter.ggo -package "clitkImageBarycenter" -version "1.0" -purpose "" - -option "config" - "Config file" string optional -option "verbose" v "Verbose" flag off - -option "imagetypes" - "Display allowed image types" flag off - -option "input" i "Input image filename" string required -option "output" o "Output image filename" string required diff --git a/tools/clitkImageBarycenterGenericFilter.h b/tools/clitkImageBarycenterGenericFilter.h deleted file mode 100644 index 695be52..0000000 --- a/tools/clitkImageBarycenterGenericFilter.h +++ /dev/null @@ -1,69 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -===========================================================================**/ -#ifndef CLITKFooIMAGEGENERICFILTER_H -#define CLITKFooIMAGEGENERICFILTER_H -#include "clitkIO.h" -#include "clitkImageToImageGenericFilter.h" - -//-------------------------------------------------------------------- -namespace clitk -{ - -template -class ITK_EXPORT ImageBarycenterGenericFilter: - public ImageToImageGenericFilter > -{ - -public: - - //-------------------------------------------------------------------- - ImageBarycenterGenericFilter(); - - //-------------------------------------------------------------------- - typedef ImageBarycenterGenericFilter Self; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - //-------------------------------------------------------------------- - // Method for creation through the object factory - // and Run-time type information (and related methods) - itkNewMacro(Self); - itkTypeMacro(ImageBarycenterGenericFilter, LightObject); - - //-------------------------------------------------------------------- - void SetArgsInfo(const args_info_type & a); - - //-------------------------------------------------------------------- - // Main function called each time the filter is updated - template - void UpdateWithInputImageType(); - -protected: - template void InitializeImageType(); - args_info_type mArgsInfo; - -}; // end class -//-------------------------------------------------------------------- - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkImageBarycenterGenericFilter.txx" -#endif - -#endif // #define clitkImageBarycenterGenericFilter_h diff --git a/tools/clitkImageBarycenterGenericFilter.txx b/tools/clitkImageBarycenterGenericFilter.txx deleted file mode 100644 index e4a6eaf..0000000 --- a/tools/clitkImageBarycenterGenericFilter.txx +++ /dev/null @@ -1,175 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -===========================================================================**/ -#ifndef clitkImageBarycenterGenericFilter_txx -#define clitkImageBarycenterGenericFilter_txx - -/* ================================================= - * @file clitkImageBarycenterGenericFilter.txx - * @author Jef Vandemeulebroucke - * @date 29 june 2009 - * - * @brief - * - ===================================================*/ - -// itk include -#include "itkConnectedComponentImageFilter.h" -#include "itkLabelImageToShapeLabelMapFilter.h" -#include - -namespace clitk -{ - -//-------------------------------------------------------------------- -template -ImageBarycenterGenericFilter::ImageBarycenterGenericFilter(): - ImageToImageGenericFilter("ImageBarycenter") -{ - InitializeImageType<2>(); - InitializeImageType<3>(); - //InitializeImageType<4>(); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -template -void ImageBarycenterGenericFilter::InitializeImageType() -{ - ADD_DEFAULT_IMAGE_TYPES(Dim); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -void ImageBarycenterGenericFilter::SetArgsInfo(const args_info_type & a) -{ - mArgsInfo=a; - this->SetIOVerbose(mArgsInfo.verbose_flag); - if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes(); - - if (mArgsInfo.input_given) { - this->SetInputFilename(mArgsInfo.input_arg); - } - if (mArgsInfo.output_given) { - this->SetOutputFilename(mArgsInfo.output_arg); - } -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -// Update with the number of dimensions and the pixeltype -//-------------------------------------------------------------------- -template -template -void -ImageBarycenterGenericFilter::UpdateWithInputImageType() -{ - - // Reading input - typename InputImageType::Pointer input = this->template GetInput(0); - - // Main filter - typedef typename InputImageType::PixelType PixelType; - typedef itk::Image OutputImageType; - - // Filter - typedef unsigned short LabelType; - typedef itk::ShapeLabelObject< LabelType, InputImageType::ImageDimension > ShapeLabelObjectType; - typedef itk::LabelMap< ShapeLabelObjectType > LabelMapType; - - typedef itk::ConnectedComponentImageFilter ConnectedComponentImageFilterType; - typedef itk::LabelImageToShapeLabelMapFilter< OutputImageType, LabelMapType> I2LType; - typename ConnectedComponentImageFilterType::Pointer connected = ConnectedComponentImageFilterType::New (); - connected->SetInput(input); - connected->Update(); - typedef itk::LabelImageToShapeLabelMapFilter< OutputImageType, LabelMapType> I2LType; - typename I2LType::Pointer i2l = I2LType::New(); - i2l->SetInput( connected->GetOutput() ); - i2l->SetComputePerimeter(true); - i2l->Update(); - LabelMapType *labelMap = i2l->GetOutput(); - std::cout << "The input image has " << labelMap->GetNumberOfLabelObjects() << " labels." << std::endl; - // Retrieve all attributes - //Only 1 object so: - unsigned int n = 0; - //for (unsigned int n = 0; n < labelMap->GetNumberOfLabelObjects(); ++n) - //{ - ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(n); - std::cout << "Label: " - << typename itk::NumericTraits< typename LabelMapType::LabelType >::PrintType(labelObject->GetLabel()) << std::endl; - //std::cout << " BoundingBox: " - // << labelObject->GetBoundingBox() << std::endl; - //std::cout << " NumberOfPixels: " - // << labelObject->GetNumberOfPixels() << std::endl; - //std::cout << " PhysicalSize: " - // << labelObject->GetPhysicalSize() << std::endl; - std::cout << " Centroid: " - << labelObject->GetCentroid() << std::endl; - //std::cout << " NumberOfPixelsOnBorder: " - // << labelObject->GetNumberOfPixelsOnBorder() << std::endl; - //std::cout << " PerimeterOnBorder: " - // << labelObject->GetPerimeterOnBorder() << std::endl; - //std::cout << " FeretDiameter: " - // << labelObject->GetFeretDiameter() << std::endl; - //std::cout << " PrincipalMoments: " - // << labelObject->GetPrincipalMoments() << std::endl; - //std::cout << " PrincipalAxes: " - // << labelObject->GetPrincipalAxes() << std::endl; - //std::cout << " Elongation: " - // << labelObject->GetElongation() << std::endl; - //std::cout << " Perimeter: " - // << labelObject->GetPerimeter() << std::endl; - //std::cout << " Roundness: " - // << labelObject->GetRoundness() << std::endl; - //std::cout << " EquivalentSphericalRadius: " - // << labelObject->GetEquivalentSphericalRadius() << std::endl; - //std::cout << " EquivalentSphericalPerimeter: " - // << labelObject->GetEquivalentSphericalPerimeter() << std::endl; - //std::cout << " EquivalentEllipsoidDiameter: " - // << labelObject->GetEquivalentEllipsoidDiameter() << std::endl; - //std::cout << " Flatness: " - // << labelObject->GetFlatness() << std::endl; - //std::cout << " PerimeterOnBorderRatio: " - // << labelObject->GetPerimeterOnBorderRatio() << std::endl; - //} - - typename OutputImageType::Pointer outputImage = OutputImageType::New(); - typename OutputImageType::RegionType region_outputImage(input->GetLargestPossibleRegion()); - outputImage->SetRegions(region_outputImage); - outputImage->SetOrigin(input->GetOrigin()); - outputImage->SetSpacing(input->GetSpacing()); - outputImage->SetDirection(input->GetDirection()); - outputImage->Allocate(); - outputImage->FillBuffer(0); - - typename InputImageType::IndexType barycenterIndex; - input->TransformPhysicalPointToIndex(labelObject->GetCentroid(),barycenterIndex); - - outputImage->SetPixel(barycenterIndex,1); - // Write/Save results - this->template SetNextOutput(outputImage); -} -//-------------------------------------------------------------------- - - -}//end clitk - -#endif //#define clitkImageBarycenterGenericFilter_txx