11 #include "TensorFormatConverterCLP.h" 12 #include "itkImageRegionIteratorWithIndex.h" 19 main (
int argc,
char const* argv[])
26 typedef itk::VectorImage<double,3> ImageType;
27 ImageType::Pointer inputImage = ImageType::New();
30 ImageType::Pointer outputImage = ImageType::New();
33 if (_OutputFormat==
"9D")
37 outputImage->SetNumberOfComponentsPerPixel(outDim);
38 outputImage->Allocate();
40 itk::ImageRegionConstIteratorWithIndex<ImageType> itInput(inputImage, inputImage->GetLargestPossibleRegion());
41 itk::ImageRegionIteratorWithIndex<ImageType> itOutput(outputImage, outputImage->GetLargestPossibleRegion());
46 ImageType::PixelType inputPixel, outputPixel(outDim);
47 for (itInput.GoToBegin(), itOutput.GoToBegin();
49 ++itInput, ++itOutput)
51 inputPixel = itInput.Get();
53 if (_InputFormat==
"9D" && _OutputFormat==
"6D_UPPER")
55 else if (_InputFormat==
"6D_UPPER" && _OutputFormat==
"9D")
58 else if (_InputFormat==
"6D_EMBED" && _OutputFormat==
"6D_UPPER")
60 else if (_InputFormat==
"6D_UPPER" && _OutputFormat==
"6D_EMBED")
63 else if (_InputFormat==
"6D_UPPER" && _OutputFormat==
"6D_LOWER")
65 else if (_InputFormat==
"6D_LOWER" && _OutputFormat==
"6D_UPPER")
68 else if (_InputFormat==
"6D_DIAGONAL_FIRST" && _OutputFormat==
"6D_LOWER")
70 else if (_InputFormat==
"6D_LOWER" && _OutputFormat==
"6D_DIAGONAL_FIRST")
73 else if (_InputFormat==
"6D_DIAGONAL_FIRST" && _OutputFormat==
"6D_UPPER")
75 else if (_InputFormat==
"6D_UPPER" && _OutputFormat==
"6D_DIAGONAL_FIRST")
81 itOutput.Set(outputPixel);
NDArray<T,1> is a vector class which uses blas mkl.
helper functions specifically used in dmritool
void ReadVectorImage(const std::string &filename, SmartPointer< VectorImage< PixelType, 3 > > &image, const std::string &printInfo="Reading Image:")
NDArray<T,2> is a row-major matrix.
bool SaveImage(const SmartPointer< ImageType > &image, const std::string &filename, const std::string &printInfo="Writing Image:")
void CopyImageInformation(const SmartPointer< ImageWithInfoType > &imageFrom, SmartPointer< ImageType > &imageTo)
#define utlGlobalException(cond, expout)
void ConvertTensor6DTo9D(const V1Type &v6d, V2Type &v9d, int v6dStoreWay)
void ConvertTensor6DTo6D(const V1Type &v6d1, V2Type &v6d2, int s1, int s2)
void ConvertTensor9DTo6D(const V1Type &v9d, V2Type &v6d, int v6dStoreWay)