filter->SetIOVerbose(args_info.verbose_flag);
filter->SetOutputFilename(output);
filter->SetVV(args_info.vv_flag);
+ filter->SetNoNiiMeta(args_info.noniimeta_flag);
filter->SetCorrectNegativeSpacingFlag(args_info.correct_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 "vv" - "Read image as in vv and save transform in meta information" flag off
-option "correct" - "Correct dicom with negative Z spacing" 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
+option "correct" - "Correct dicom with negative Z spacing" flag off
+option "noniimeta" - "Multiply 1st and 2nd coordinate of Direction and Origin by -1" flag off
#include "vvImageWriter.h"
#include "itkFlipImageFilter.h"
#include "itkGDCMImageIO.h"
+#include <itkChangeInformationImageFilter.h>
#include "gdcmReader.h"
#include "gdcmAttribute.h"
itk::MetaDataDictionary dict;// = new itk::MetaDataDictionary;
input->SetMetaDataDictionary(dict);
}
- this->SetNextOutput<InputImageType>(input);
+ typedef itk::ChangeInformationImageFilter<InputImageType> CIType;
+ typename CIType::Pointer changeInfo = CIType::New();
+ if(mNoNiiMeta) {
+ changeInfo->SetInput(input);
+ typename CIType::PointType o = input->GetOrigin();
+ o[0] *= -1.;
+ o[1] *= -1.;
+ typename CIType::DirectionType d = input->GetDirection();
+ d[0][0] *= -1.;
+ d[1][1] *= -1.;
+ changeInfo->ChangeDirectionOn();
+ changeInfo->ChangeOriginOn();
+ changeInfo->SetOutputOrigin(o);
+ changeInfo->SetOutputDirection(d);
+ changeInfo->Update();
+ input = changeInfo->GetOutput();
+ }
+
+ this->SetNextOutput<InputImageType>(input);
} else {
// "trick" to call independent versions of update according to the
std::string GetOutputPixelTypeName() { return mOutputPixelTypeName; }
void SetOutputPixelType(std::string p) { mOutputPixelTypeName = p; }
void SetVV(bool b) { mVV = b; }
+ void SetNoNiiMeta(bool b) { mNoNiiMeta = b; }
bool IsWarningOccur() { return mWarningOccur; }
std::string & GetWarning() { return mWarning; }
void EnableDisplayWarning(bool b) { mDisplayWarning = b; }
bool mWarningOccur;
bool mDisplayWarning;
bool mVV;
+ bool mNoNiiMeta;
bool mCorrectNegativeSpacingFlag;
private: