20 #include "VectorImageNormalizationCLP.h" 32 main (
int argc,
char const* argv[])
39 typedef float PixelType;
47 InputImageType::Pointer input = InputImageType::New();
48 OutputImageType::Pointer output = OutputImageType::New();
52 itk::ReadImage<InputImageType, ReaderType>(_InputFile, input);
55 FilterType::Pointer filter = FilterType::New();
57 filter->SetInput(input);
58 if (_NormalizationType==
"SUM")
59 filter->SetNormalizeType(FilterType::FunctorType::SUM);
60 else if (_NormalizationType==
"L1NORM")
61 filter->SetNormalizeType(FilterType::FunctorType::L1NORM);
62 else if (_NormalizationType==
"L2NORM")
63 filter->SetNormalizeType(FilterType::FunctorType::L2NORM);
66 filter->SetNumberOfThreads(1);
69 output = filter->GetOutput();
71 itk::SaveImage<OutputImageType, WriterType>(output, _OutputFile);
75 typedef itk::VectorImage<PixelType, 3> InputImageType;
76 typedef itk::VectorImage<PixelType, 3> OutputImageType;
78 InputImageType::Pointer input = InputImageType::New();
79 OutputImageType::Pointer output = OutputImageType::New();
84 FilterType::Pointer filter = FilterType::New();
86 filter->SetInput(input);
87 if (_NormalizationType==
"SUM")
88 filter->SetNormalizeType(FilterType::FunctorType::SUM);
89 else if (_NormalizationType==
"L1NORM")
90 filter->SetNormalizeType(FilterType::FunctorType::L1NORM);
91 else if (_NormalizationType==
"L2NORM")
92 filter->SetNormalizeType(FilterType::FunctorType::L2NORM);
96 output = filter->GetOutput();
int main(int argc, char const *argv[])
Normalize each voxel in a VectorImage or SparseVectorImage.
bool SaveImage(const SmartPointer< ImageType > &image, const std::string &filename, const std::string &printInfo="Writing Image:")
bool IsSparseImage(const std::string &filename)
Writes sparse vector image data to key and value files.
Pixel-wise vector normalization.
bool ReadImage(const std::string &filename, SmartPointer< ImageType > &image, const std::string &printInfo="Reading Image:")
#define utlGlobalException(cond, expout)
Reads sparse image data from key and value files.
An n-dimensional vector image with a sparse memory model.