filter->SetInputFilenames(l);
filter->SetIOVerbose(args_info.verbose_flag);
filter->SetOutputFilename(output);
+ filter->SetVV(args_info.vv_flag);
filter->EnableWriteCompression(args_info.compression_flag);
if (args_info.type_given) filter->SetOutputPixelType(args_info.type_arg);
version "1.0"
purpose "Convert an image into another image.\n\tAllow to change the file format and/or the pixel type. \n\tKnown file formats 2D: jpeg png bmp tif mhd hdr vox dcm \n\tKnown file formats 3D: mhd vox hdr dcm\n\tKnown file formats 4D: mhd \n\tKnown images: 2D 3D or 4D, schar, uchar, short, ushort, int, float and double\n\nIf the -o option is not given, the last parameter of the command line is used as output."
-option "config" - "Config file" string no
-option "input" i "Input image filename" string no
-option "output" o "Output image filename" string no
-option "type" t "Output type (float, ushort ...)" string no
-option "verbose" v "Verbose" flag off
-option "compression" c "Compress output" flag off
+option "config" - "Config file" string no
+option "input" i "Input image filename" string no
+option "output" o "Output image filename" string no
+option "type" t "Output type (float, ushort ...)" string no
+option "verbose" v "Verbose" flag off
+option "compression" c "Compress output" flag off
+option "vv" - "Read image as in vv and save transform in meta information" flag off
#define CLITKIMAGECONVERTGENERICFILTER_CXX
#include "clitkImageConvertGenericFilter.h"
+#include "vvImageReader.h"
+#include "vvImageWriter.h"
//--------------------------------------------------------------------
clitk::ImageConvertGenericFilter::ImageConvertGenericFilter():
}
}
- if ((m_PixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) {
+ if(mVV) {
+ if (mOutputPixelTypeName != "NotSpecified" || m_WriteCompression) {
+ std::cerr << "--vv is not compatible with --compression and --type options." << std::endl;
+ exit(-1);
+ }
+
+ vvImageReader::Pointer reader = vvImageReader::New();
+ reader->SetInputFilenames(m_InputFilenames);
+ reader->Update(vvImageReader::IMAGE);
+
+ vvImageWriter::Pointer writer = vvImageWriter::New();
+ writer->SetOutputFileName(m_OutputFilenames.front());
+ writer->SetSaveTransform(true);
+ writer->SetInput(reader->GetOutput());
+ writer->Update();
+ return;
+ }
+ else if ((m_PixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) {
typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
this->SetNextOutput<InputImageType>(input);
} else {
std::string GetInputPixelTypeName() { return m_PixelTypeName; }
std::string GetOutputPixelTypeName() { return mOutputPixelTypeName; }
void SetOutputPixelType(std::string p) { mOutputPixelTypeName = p; }
+ void SetVV(bool b) { mVV = b; }
bool IsWarningOccur() { return mWarningOccur; }
std::string & GetWarning() { return mWarning; }
void EnableDisplayWarning(bool b) { mDisplayWarning = b; }
std::string mWarning;
bool mWarningOccur;
bool mDisplayWarning;
+ bool mVV;
private:
template <class InputImageType, bool isVector>