ADD_EXECUTABLE(clitkLevelSetSegmentation clitkLevelSetSegmentation.cxx clitkLevelSetSegmentationGenericFilter.cxx ${clitkLevelSetSegmentation_GGO_C})
TARGET_LINK_LIBRARIES(clitkLevelSetSegmentation clitkCommon ITKIO)
-# WRAP_GGO(clitkBinarizeImage_GGO_C clitkBinarizeImage.ggo)
-# ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx clitkBinarizeImageGenericFilter.cxx ${clitkBinarizeImage_GGO_C})
-# TARGET_LINK_LIBRARIES(clitkBinarizeImage clitkCommon ITKIO)
-
WRAP_GGO(clitkAnd_GGO_C clitkAnd.ggo)
ADD_EXECUTABLE(clitkAnd clitkAnd.cxx clitkAndGenericFilter.cxx ${clitkAnd_GGO_C})
TARGET_LINK_LIBRARIES(clitkAnd clitkCommon ITKIO )
+++ /dev/null
-/*=========================================================================
- 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://oncora1.lyon.fnclcc.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 clitkBinarizeImageGenericFilter.txx
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date 29 June 2009
- *
- * @brief Binarize an image
- *
- ===================================================*/
-
-
-// clitk
-#include "clitkBinarizeImage_ggo.h"
-#include "clitkIO.h"
-#include "clitkBinarizeImageGenericFilter.h"
-
-
-//--------------------------------------------------------------------
-int main(int argc, char * argv[]) {
-
- // Init command line
- GGO(clitkBinarizeImage, args_info);
- CLITK_INIT;
-
- // Filter
- clitk::BinarizeImageGenericFilter::Pointer genericFilter=clitk::BinarizeImageGenericFilter::New();
-
- genericFilter->SetArgsInfo(args_info);
- genericFilter->Update();
-
- return EXIT_SUCCESS;
-}// end main
-
-//--------------------------------------------------------------------
+++ /dev/null
-#File clitkBinarizeImage.ggo
-Package "clitkBinarizeImage"
-version "1.0"
-purpose "Binarize an image using a lower and/or upper threshold, and by specifying inside and outside values"
-
-option "config" - "Config file" string no
-option "verbose" v "Verbose" flag off
-
-option "input" i "Input image filename" string yes
-option "output" o "Output image filename" string yes
-option "lower" l "Lower intensity (default=min)" double no
-option "upper" u "Upper intensity (default=max)" double no
-option "inside" - "Inside value" double no default="1"
-option "outside" - "Outside value" double no default="0"
+++ /dev/null
-/*=========================================================================
- 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://oncora1.lyon.fnclcc.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 clitkBinarizeImageGenericFilter_cxx
-#define clitkBinarizeImageGenericFilter_cxx
-
-/* =================================================
- * @file clitkBinarizeImageGenericFilter.cxx
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date 29 june 2009
- *
- * @brief
- *
- ===================================================*/
-
-#include "clitkBinarizeImageGenericFilter.h"
-
-
-namespace clitk
-{
-
-
- //-----------------------------------------------------------
- // Constructor
- //-----------------------------------------------------------
- BinarizeImageGenericFilter::BinarizeImageGenericFilter()
- {
- m_Verbose=false;
- m_InputFileName="";
- }
-
-
- //-----------------------------------------------------------
- // Update
- //-----------------------------------------------------------
- void BinarizeImageGenericFilter::Update()
- {
- // Read the Dimension and PixelType
- int Dimension;
- std::string PixelType;
- ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType);
-
-
- // Call UpdateWithDim
- if(Dimension==2) UpdateWithDim<2>(PixelType);
- else if(Dimension==3) UpdateWithDim<3>(PixelType);
- // else if (Dimension==4)UpdateWithDim<4>(PixelType);
- else
- {
- std::cout<<"Error, Only for 2 or 3 Dimensions!!!"<<std::endl ;
- return;
- }
- }
-
-
-} //end clitk
-
-#endif //#define clitkBinarizeImageGenericFilter_cxx
+++ /dev/null
-/*=========================================================================
- 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://oncora1.lyon.fnclcc.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 clitkBinarizeImageGenericFilter_h
-#define clitkBinarizeImageGenericFilter_h
-
-/* =================================================
- * @file clitkBinarizeImageGenericFilter.h
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date 29 june 2009
- *
- * @brief
- *
- ===================================================*/
-
-
-// clitk include
-#include "clitkIO.h"
-#include "clitkCommon.h"
-#include "clitkImageCommon.h"
-#include "clitkBinarizeImage_ggo.h"
-
-//itk include
-#include "itkLightObject.h"
-#include "itkBinaryThresholdImageFilter.h"
-
-namespace clitk
-{
-
-
- class ITK_EXPORT BinarizeImageGenericFilter : public itk::LightObject
- {
- public:
- //----------------------------------------
- // ITK
- //----------------------------------------
- typedef BinarizeImageGenericFilter Self;
- typedef itk::LightObject Superclass;
- typedef itk::SmartPointer<Self> Pointer;
- typedef itk::SmartPointer<const Self> ConstPointer;
-
- // Method for creation through the object factory
- itkNewMacro(Self);
-
- // Run-time type information (and related methods)
- itkTypeMacro( BinarizeImageGenericFilter, LightObject );
-
-
- //----------------------------------------
- // Typedefs
- //----------------------------------------
-
-
- //----------------------------------------
- // Set & Get
- //----------------------------------------
- void SetArgsInfo(const args_info_clitkBinarizeImage & a)
- {
- m_ArgsInfo=a;
- m_Verbose=m_ArgsInfo.verbose_flag;
- m_InputFileName=m_ArgsInfo.input_arg;
- }
-
- //----------------------------------------
- // Update
- //----------------------------------------
- void Update();
-
- protected:
-
- //----------------------------------------
- // Constructor & Destructor
- //----------------------------------------
- BinarizeImageGenericFilter();
- ~BinarizeImageGenericFilter() {};
-
-
- //----------------------------------------
- // Templated members
- //----------------------------------------
- template <unsigned int Dimension> void UpdateWithDim(std::string PixelType);
- template <unsigned int Dimension, class PixelType> void UpdateWithDimAndPixelType();
-
-
- //----------------------------------------
- // Data members
- //----------------------------------------
- args_info_clitkBinarizeImage m_ArgsInfo;
- bool m_Verbose;
- std::string m_InputFileName;
-
- };
-
-
-} // end namespace clitk
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#include "clitkBinarizeImageGenericFilter.txx"
-#endif
-
-#endif // #define clitkBinarizeImageGenericFilter_h
+++ /dev/null
-/*=========================================================================
- 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://oncora1.lyon.fnclcc.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 clitkBinarizeImageGenericFilter_txx
-#define clitkBinarizeImageGenericFilter_txx
-
-/* =================================================
- * @file clitkBinarizeImageGenericFilter.txx
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date 29 june 2009
- *
- * @brief
- *
- ===================================================*/
-
-
-namespace clitk
-{
-
- //-------------------------------------------------------------------
- // Update with the number of dimensions
- //-------------------------------------------------------------------
- template<unsigned int Dimension>
- void
- BinarizeImageGenericFilter::UpdateWithDim(std::string PixelType)
- {
- if (m_Verbose) std::cout << "Image was detected to be "<<Dimension<<"D and "<< PixelType<<"..."<<std::endl;
-
- if(PixelType == "short"){
- if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed short..." << std::endl;
- UpdateWithDimAndPixelType<Dimension, signed short>();
- }
- // else if(PixelType == "unsigned_short"){
- // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl;
- // UpdateWithDimAndPixelType<Dimension, unsigned short>();
- // }
-
- else if (PixelType == "unsigned_char"){
- if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
- UpdateWithDimAndPixelType<Dimension, unsigned char>();
- }
-
- // else if (PixelType == "char"){
- // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
- // UpdateWithDimAndPixelType<Dimension, signed char>();
- // }
- else {
- if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl;
- UpdateWithDimAndPixelType<Dimension, float>();
- }
- }
-
-
- //-------------------------------------------------------------------
- // Update with the number of dimensions and the pixeltype
- //-------------------------------------------------------------------
- template <unsigned int Dimension, class PixelType>
- void
- BinarizeImageGenericFilter::UpdateWithDimAndPixelType()
- {
-
- // ImageTypes
- typedef itk::Image<PixelType, Dimension> InputImageType;
- typedef itk::Image<PixelType, Dimension> OutputImageType;
-
- // Read the input
- typedef itk::ImageFileReader<InputImageType> InputReaderType;
- typename InputReaderType::Pointer reader = InputReaderType::New();
- reader->SetFileName( m_InputFileName);
- typename InputImageType::Pointer input= reader->GetOutput();
-
- // Filter
- typedef itk::BinaryThresholdImageFilter<InputImageType, OutputImageType> BinaryThresholdImageFilterType;
- typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New();
- thresholdFilter->SetInput(input);
- if(m_ArgsInfo.lower_given) thresholdFilter->SetLowerThreshold(static_cast<PixelType>(m_ArgsInfo.lower_arg));
- if(m_ArgsInfo.upper_given) thresholdFilter->SetUpperThreshold(static_cast<PixelType>(m_ArgsInfo.upper_arg));
- thresholdFilter->SetInsideValue(m_ArgsInfo.inside_arg);
- thresholdFilter->SetOutsideValue(m_ArgsInfo.outside_arg);
- typename OutputImageType::Pointer output=thresholdFilter->GetOutput();
-
- // Output
- typedef itk::ImageFileWriter<OutputImageType> WriterType;
- typename WriterType::Pointer writer = WriterType::New();
- writer->SetFileName(m_ArgsInfo.output_arg);
- writer->SetInput(output);
- writer->Update();
-
- }
-
-
-}//end clitk
-
-#endif //#define clitkBinarizeImageGenericFilter_txx