#Author: Jef Vandemeulebroucke <jefvdmb@gmail.com>
#Date : Tue 15 June 16.35
-package "clitk"
-version "Read a series a nD images (unnamed inputs) and merge them to a (n+1)D image"
+package "clitkMergeSequence"
+version "Read a series of nD images (unnamed inputs) and merge them to a (n+1)D image"
-option "config" - "Config file" string no
-option "spacing" s "Spacing for the new dimension" double no default="1"
-option "output" o "Output VF filename" string yes
-option "verbose" v "Verbose" flag off
+option "config" - "Config file" string no
+option "spacing" s "Spacing for the new dimension" double no default="1"
+option "output" o "Output filename" string yes
+option "verbose" v "Verbose" flag off
//Get the image Dimension and PixelType
int Dimension, Components;
std::string PixelType;
-
+
clitk::ReadImageDimensionAndPixelType(m_InputNames[0], Dimension, PixelType, Components);
if(Dimension==2) UpdateWithDim<2>(PixelType, Components);
else if(Dimension==3) UpdateWithDim<3>(PixelType, Components);
- else
- {
- std::cout<<"Error, Only for 2 and 3 Dimensions!!!"<<std::endl ;
- return;
- }
+ else {
+ std::cout<<"Error, Only for 2 and 3 Dimensions!!!"<<std::endl ;
+ return;
+ }
}
} //end namespace
namespace clitk
{
-
+
class ITK_EXPORT MergeSequenceGenericFilter : public itk::LightObject
-
+
{
public:
typedef MergeSequenceGenericFilter 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);
double m_Spacing;
std::string m_OutputName;
bool m_Verbose;
-
+
};
//Define the input and output image type
typedef itk::Image<PixelType, Dimension> InputImageType;
typedef itk::Image<PixelType, Dimension+1> OutputImageType;
-
+
//Read the input image series
typedef itk::ImageSeriesReader<OutputImageType> ImageReaderType;
typename ImageReaderType::Pointer reader= ImageReaderType::New();
reader->SetFileNames(m_InputNames);
reader->Update();
typename OutputImageType::Pointer image =reader->GetOutput();
-
+
//Set the spacing
typename OutputImageType::SpacingType spacing=image->GetSpacing();
spacing[Dimension]=m_Spacing;