#include "vvImageWriter.h"
#include "itkFlipImageFilter.h"
#include "itkGDCMImageIO.h"
+#include <itkChangeInformationImageFilter.h>
#include "gdcmReader.h"
#include "gdcmAttribute.h"
// Read the attribute Image Position (Patient)
gdcm::Tag DetectorInformationSequenceTag(0x0054,0x0022);
const gdcm::DataElement & DIS = ds.GetDataElement(DetectorInformationSequenceTag);
+ if (!DIS.GetByteValue()) {
+ std::cout << "Error: could not find 0x0054,0x0022 tag. Abort." << std::endl;
+ exit(0);
+ }
gdcm::SmartPointer<gdcm::SequenceOfItems> sqf = DIS.GetValueAsSQ();
gdcm::Item & item = sqf->GetItem(1);
gdcm::DataSet & ds_position = item.GetNestedDataSet();
// Empty meta info
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
// pixel type (vector or scalar), using partial specializations