target_link_libraries(clitkUnsharpMask clitkCommon )
set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkUnsharpMask)
- WRAP_GGO(clitkFooImage_GGO_C clitkFooImage.ggo)
- add_executable(clitkFooImage clitkFooImage.cxx ${clitkFooImage_GGO_C})
- target_link_libraries(clitkFooImage clitkCommon )
- set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkFooImage)
-
WRAP_GGO(clitkMedianImageFilter_GGO_C clitkMedianImageFilter.ggo)
add_executable(clitkMedianImageFilter clitkMedianImageFilter.cxx ${clitkMedianImageFilter_GGO_C})
target_link_libraries(clitkMedianImageFilter clitkMedianImageFilterLib clitkCommon)
target_link_libraries(clitkMIP clitkMIPLib clitkCommon)
set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMIP)
+ WRAP_GGO(clitkSum_GGO_C clitkSum.ggo)
+ add_executable(clitkSum clitkSum.cxx ${clitkSum_GGO_C})
+ target_link_libraries(clitkSum clitkCommon)
+ set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSum)
+
WRAP_GGO(clitkTransformLandmarks_GGO_C clitkTransformLandmarks.ggo)
add_executable(clitkTransformLandmarks clitkTransformLandmarks.cxx ${clitkTransformLandmarks_GGO_C})
target_link_libraries(clitkTransformLandmarks clitkCommon)
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
===========================================================================**/
-/* =================================================
- * @file clitkFooImageGenericFilter.txx
- * @author xxx <xxx@creatis.insa-lyon.fr>
- * @date 29 June 2029
- *
- * @brief FooImage an image
- *
- ===================================================*/
-
// clitk
#include "clitkFooImage_ggo.h"
#include "clitkFooImageGenericFilter.h"
option "input" i "Input image filename" string required
option "output" o "Output image filename" string required
-option "lower" l "Lower intensity (default=min), fg is greater than this value" double optional
-option "upper" u "Upper intensity (default=max), fg is lower than this value" double optional
-option "fg" - "Foreground (FG) or 'inside' value" double optional default="1"
-option "bg" - "Background (BG) or 'ouside' value" double optional default="0"
-option "mode" - "Use FG and/or BG values (if FG, the BG is replaced by the input image values)" values="FG","BG","both" default="both" optional
- 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
+#ifndef clitkFooImageGenericFilter_h
+#define clitkFooImageGenericFilter_h
#include "clitkIO.h"
#include "clitkImageToImageGenericFilter.h"
#ifndef clitkFooImageGenericFilter_txx
#define clitkFooImageGenericFilter_txx
-/* =================================================
- * @file clitkFooImageGenericFilter.txx
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date 29 june 2009
- *
- * @brief
- *
- ===================================================*/
-
// itk include
#include "itkBinaryThresholdImageFilter.h"
#include "itkMaskImageFilter.h"
typedef itk::BinaryThresholdImageFilter<InputImageType, OutputImageType> BinaryThresholdImageFilterType;
typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New();
thresholdFilter->SetInput(input);
- thresholdFilter->SetInsideValue(mArgsInfo.fg_arg);
-
- if (mArgsInfo.lower_given) thresholdFilter->SetLowerThreshold(static_cast<PixelType>(mArgsInfo.lower_arg));
- if (mArgsInfo.upper_given) thresholdFilter->SetUpperThreshold(static_cast<PixelType>(mArgsInfo.upper_arg));
-
- if (mArgsInfo.mode_arg == std::string("both")) {
- thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg);
- thresholdFilter->Update();
-
- typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
- this->template SetNextOutput<OutputImageType>(outputImage);
- } else {
- typename InputImageType::Pointer outputImage;
- thresholdFilter->SetOutsideValue(0);
- if (mArgsInfo.mode_arg == std::string("BG")) {
- typedef itk::MaskImageFilter<InputImageType,OutputImageType> maskFilterType;
- typename maskFilterType::Pointer maskFilter = maskFilterType::New();
- maskFilter->SetInput1(input);
- maskFilter->SetInput2(thresholdFilter->GetOutput());
- maskFilter->SetOutsideValue(mArgsInfo.bg_arg);
- maskFilter->Update();
- outputImage = maskFilter->GetOutput();
- } else {
- typedef itk::MaskNegatedImageFilter<InputImageType,OutputImageType> maskFilterType;
- typename maskFilterType::Pointer maskFilter = maskFilterType::New();
- maskFilter->SetInput1(input);
- maskFilter->SetInput2(thresholdFilter->GetOutput());
- maskFilter->SetOutsideValue(mArgsInfo.fg_arg);
- maskFilter->Update();
- outputImage = maskFilter->GetOutput();
- }
- // Write/Save results
- this->template SetNextOutput<InputImageType>(outputImage);
- }
+ // Set filter members
+
+ // Write/Save results
+ typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
+ this->template SetNextOutput<OutputImageType>(outputImage);
}
//--------------------------------------------------------------------
--- /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://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
+===========================================================================**/
+
+// clitk
+#include "clitkSum_ggo.h"
+#include "clitkSumGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+ // Init command line
+ GGO(clitkSum, args_info);
+ CLITK_INIT;
+
+ // Filter
+ typedef clitk::SumGenericFilter<args_info_clitkSum> FilterType;
+ FilterType::Pointer filter = FilterType::New();
+
+ filter->SetArgsInfo(args_info);
+ try {
+ filter->Update();
+ } catch(std::runtime_error e) {
+ std::cout << e.what() << std::endl;
+ }
+
+ return EXIT_SUCCESS;
+}// end main
+
+//--------------------------------------------------------------------
--- /dev/null
+#File clitkSum.ggo
+package "clitkSum"
+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
+option "dimension" d "Dimension along which to sum" int yes
--- /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://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 clitkSumGenericFilter_h
+#define clitkSumGenericFilter_h
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+template<class args_info_type>
+class ITK_EXPORT SumGenericFilter:
+ public ImageToImageGenericFilter<SumGenericFilter<args_info_type> >
+{
+
+public:
+
+ //--------------------------------------------------------------------
+ SumGenericFilter();
+
+ //--------------------------------------------------------------------
+ typedef SumGenericFilter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+
+ //--------------------------------------------------------------------
+ // Method for creation through the object factory
+ // and Run-time type information (and related methods)
+ itkNewMacro(Self);
+ itkTypeMacro(SumGenericFilter, LightObject);
+
+ //--------------------------------------------------------------------
+ void SetArgsInfo(const args_info_type & a);
+
+ //--------------------------------------------------------------------
+ // Main function called each time the filter is updated
+ template<class InputImageType>
+ void UpdateWithInputImageType();
+
+protected:
+ template<unsigned int Dim> void InitializeImageType();
+ args_info_type mArgsInfo;
+
+}; // end class
+//--------------------------------------------------------------------
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkSumGenericFilter.txx"
+#endif
+
+#endif // #define clitkSumGenericFilter_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://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 clitkSumGenericFilter_txx
+#define clitkSumGenericFilter_txx
+
+// itk include
+#include <itkSumProjectionImageFilter.h>
+#include <clitkCommon.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+SumGenericFilter<args_info_type>::SumGenericFilter():
+ ImageToImageGenericFilter<Self>("Sum")
+{
+ InitializeImageType<3>();
+ InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void SumGenericFilter<args_info_type>::InitializeImageType()
+{
+ ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void SumGenericFilter<args_info_type>::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<class args_info_type>
+template<class InputImageType>
+void
+SumGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+
+ // Reading input
+ typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+
+ // Main filter
+ typedef typename InputImageType::PixelType PixelType;
+ const int Dim = InputImageType::ImageDimension;
+ typedef itk::Image<PixelType,Dim> ImageType;
+ typedef itk::Image<PixelType,Dim-1> OutputImageType;
+
+ // Filter
+ typedef itk::SumProjectionImageFilter<ImageType,OutputImageType> FilterType;
+ typename FilterType::Pointer filter = FilterType::New();
+ filter->SetProjectionDimension(mArgsInfo.dimension_arg);
+ filter->SetInput(input);
+ filter->Update();
+ this->template SetNextOutput<OutputImageType>(filter->GetOutput());
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif //#define clitkSumGenericFilter_txx