DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
ImageMultiplication.cxx
Go to the documentation of this file.
1 
17 #include "utlITK.h"
18 
19 #include "ImageMultiplicationCLP.h"
21 
22 
26 int
27 main (int argc, char const* argv[])
28 {
29  // GenerateCLP
30  PARSE_ARGS;
31 
32  typedef float FloatType;
33 
34  // NOTE: use 4D to work for VectorImage<FloatType,3> and Image<FloatType,4>
35  typedef itk::VectorImage<FloatType,4> InputImageType;
36  typedef itk::VectorImage<FloatType,4> OutputImageType;
37  typedef InputImageType::PixelType ContainerType;
38 
39  InputImageType::Pointer input = InputImageType::New();
40  itk::ReadImage(_InputFile, input);
41  int pixelDimension = input->GetNumberOfComponentsPerPixel();
42 
44  MultiplyFilterType::Pointer filter = MultiplyFilterType::New();
45 
46 
47  ContainerType vec;
48  vec.SetSize(pixelDimension);
49  for ( int i = 0; i < pixelDimension; i += 1 )
50  vec[i] = _Scale;
51 
52  filter->SetInput(input);
53  filter->SetConstantVector(vec);
54 
55  filter->Update();
56 
57  OutputImageType::Pointer output = filter->GetOutput();
58 
59  itk::SaveImage(output, _OutputFile);
60 
61  return 0;
62 }
int main(int argc, char const *argv[])
mutiple a const to a image (replaced by 4DImageMath).
bool SaveImage(const SmartPointer< ImageType > &image, const std::string &filename, const std::string &printInfo="Writing Image:")
Definition: utlITK.h:157
bool ReadImage(const std::string &filename, SmartPointer< ImageType > &image, const std::string &printInfo="Reading Image:")
Definition: utlITK.h:110