15#ifndef __vtkITKArchetypeImageSeriesReader_h
16#define __vtkITKArchetypeImageSeriesReader_h
22#include "vtkImageAlgorithm.h"
26#include "itkImageIOBase.h"
27#include "itkMetaDataDictionary.h"
28#include "itkSpatialOrientation.h"
58 void PrintSelf(ostream& os, vtkIndent indent)
override;
382 if (this->
ContentTime[k].find(contentTime) != std::string::npos)
394 if (this->
TriggerTime[k].find(triggerTime) != std::string::npos)
406 if (this->
EchoNumbers[k].find(echoNumbers) != std::string::npos)
417 for (
int n = 0; n < 3; n++)
419 a += dgo[n] * dgo[n];
426 for (
int n = 0; n < 3; n++)
429 c += this->DiffusionGradientOrientation[k][n] * dgo[n];
431 c = fabs(c) / sqrt(a * b);
443 std::vector<float>::iterator iter = std::find(this->
SliceLocation.begin(), this->SliceLocation.end(), sliceLocation);
450 float a = sqrt(directionCosine[0] * directionCosine[0] + directionCosine[1] * directionCosine[1] + directionCosine[2] * directionCosine[2]);
451 for (
int k = 0; k < 3; k++)
453 directionCosine[k] /= a;
455 a = sqrt(directionCosine[3] * directionCosine[3] + directionCosine[4] * directionCosine[4] + directionCosine[5] * directionCosine[5]);
456 for (
int k = 3; k < 6; k++)
458 directionCosine[k] /= a;
464 a = sqrt(aVec[0] * aVec[0] + aVec[1] * aVec[1] + aVec[2] * aVec[2]);
465 float b = (directionCosine[0] * aVec[0] + directionCosine[1] * aVec[1] + directionCosine[2] * aVec[2]) / a;
471 a = sqrt(aVec[3] * aVec[3] + aVec[4] * aVec[4] + aVec[5] * aVec[5]);
472 b = (directionCosine[3] * aVec[3] + directionCosine[4] * aVec[4] + directionCosine[5] * aVec[5]) / a;
484 for (
int n = 0; n < 3; n++)
486 a += ipp[n] * ipp[n];
493 for (
int n = 0; n < 3; n++)
496 c += this->ImagePositionPatient[k][n] * ipp[n];
498 c = fabs(c) / sqrt(a * b);
550 float* dgo =
new float[3];
551 for (
int k = 0; k < 3; k++)
573 float* dgo =
new float[6];
574 for (
int k = 0; k < 6; k++)
587 float* ipp =
new float[3];
588 for (
int k = 0; k < 3; k++)
605 std::string aVector(aUID);
618 std::string aVector(aTime);
631 std::string aVector(aTime);
644 std::string aVector(aEcho);
656 std::vector<float> aVector(3);
657 float aMag = sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
658 for (k = 0; k < 3; k++)
660 aVector[k] = a[k] / aMag;
697 std::vector<float> aVector(6);
698 float aMag = sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
699 float bMag = sqrt(a[3] * a[3] + a[4] * a[4] + a[5] * a[5]);
700 for (k = 0; k < 3; k++)
702 aVector[k] = a[k] / aMag;
703 aVector[k + 3] = a[k + 3] / bMag;
718 std::vector<float> aVector(3);
719 for (
unsigned int i = 0; i < 3; i++)
736 int idxDiffusionGradientOrientation,
737 int idxSliceLocation,
738 int idxImageOrientationPatient);
744 int idxDiffusionGradientOrientation,
745 int idxSliceLocation,
746 int idxImageOrientationPatient,
bool GetGroupingByTags()
set/get functions for grouping by tags
void GetScalarRangeMetaDataKeys(itk::ImageIOBase::Pointer imageIO, std::string range_keys[2])
char UseNativeCoordinateOrientation
unsigned int GetNumberOfEchoNumbers()
void SetGroupingByTagsOff()
const char * GetNthContentTime(unsigned int n)
virtual void SetOutputScalarTypeToUnsignedLong()
void SetSelectedTriggerTime(int v)
float * GetNthImageOrientationPatient(unsigned int n)
const char * GetNthFileName(int idxSeriesInstanceUID, int idxContentTime, int idxTriggerTime, int idxEchoNumbers, int idxDiffusionGradientOrientation, int idxSliceLocation, int idxImageOrientationPatient, int n)
std::vector< std::vector< float > > DiffusionGradientOrientation
virtual int CanReadFile(const char *filename)
Determine if the file can be read using ITK.
std::vector< std::string > TagValues
unsigned int GetNumberOfImagePositionPatient()
static bool IsListPixelComponentTypeInMetaDataDictionary(const itk::MetaDataDictionary &dictionary)
unsigned int AddFileName(const char *filename)
vtkMatrix4x4 * RasToIjkMatrix
itk::SpatialOrientationEnums::ValidCoordinateOrientations CoordinateOrientationCode
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
int InsertSliceLocation(float a)
void SetGroupingByTagsOn()
virtual void SetOutputScalarTypeToFloat()
~vtkITKArchetypeImageSeriesReader() override
void SetSelectedContentTime(int v)
vtkMatrix4x4 * MeasurementFrameMatrix
std::vector< std::vector< float > > ImageOrientationPatient
std::vector< std::string > EchoNumbers
void SetMetaDataScalarRangeToPointDataInfo(vtkImageData *data)
int ExistSliceLocation(float sliceLocation)
CoordinateOrientationCode DesiredCoordinateOrientation
void SetDesiredCoordinateOrientationToAxial()
Set the orientation of the output image.
unsigned int GetNumberOfFileNames()
See how many file names were generated during ExecuteInformation.
void SetSelectedDiffusion(int v)
void SetSelectedOrientation(int v)
int ExistTriggerTime(const char *triggerTime)
void SetUseNativeOriginOn()
Use image origin from the file.
int InsertSeriesInstanceUIDs(const char *aUID)
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void SetOutputScalarTypeToNative()
virtual void SetOutputScalarTypeToDouble()
int ExistImageOrientationPatient(float *directionCosine)
static vtkITKArchetypeImageSeriesReader * New()
std::vector< float > SliceLocation
unsigned int GetNumberOfDiffusionGradientOrientation()
int UseOrientationFromFile
unsigned int NumberOfComponents
std::vector< std::string > TriggerTime
virtual void SetOutputScalarTypeToInt()
void SetSelectedUID(int v)
unsigned int GetNumberOfImageOrientationPatient()
unsigned int GetNumberOfTriggerTime()
std::vector< std::vector< float > > ImagePositionPatient
itk::MetaDataDictionary Dictionary
virtual void SetDICOMImageIOApproach(int)
void SetDesiredCoordinateOrientationToNative()
int ExistImagePositionPatient(float *ipp)
void AnalyzeDicomHeaders()
static std::string GetMetaDataWithoutSpaces(const itk::MetaDataDictionary &dict, const std::string &tag)
Get MetaData from dictionary, removing all whitespaces from the string.
vtkMatrix4x4 * GetRasToIjkMatrix()
Returns an IJK to RAS transformation matrix.
int ExistSeriesInstanceUID(const char *SeriesInstanceUID)
check the existence of given discriminator
int InsertDiffusionGradientOrientation(float *a)
unsigned int IndexArchetype
void AssembleNthVolume(int n)
const char * GetNthValue(unsigned int n)
unsigned int GetNumberOfItemsInDictionary()
virtual void SetOutputScalarTypeToUnsignedChar()
void SetUseNativeOriginOff()
Use image center as origin.
int AssembleVolumeContainingArchetype()
float GetNthSliceLocation(unsigned int n)
int InsertTriggerTime(const char *aTime)
void SetDesiredCoordinateOrientationToSagittal()
virtual void SetOutputScalarTypeToUnsignedInt()
int GetSelectedEchoNumbers()
std::vector< long int > IndexEchoNumbers
std::vector< std::string > Tags
std::vector< long int > IndexImagePositionPatient
double DefaultDataOrigin[3]
const char * GetTagValue(char *tag)
int GetSelectedContentTime()
const char * GetNthSeriesInstanceUID(unsigned int n)
methods to get N-th discriminator
std::vector< long int > IndexContentTime
unsigned int GetNumberOfContentTime()
std::vector< std::string > ContentTime
const itk::MetaDataDictionary & GetMetaDataDictionary() const
Return the MetaDataDictionary from the ITK layer.
std::vector< long int > IndexImageOrientationPatient
int InsertEchoNumbers(const char *aEcho)
const char * GetNthKey(unsigned int n)
std::vector< std::string > FileNames
std::vector< long int > IndexTriggerTime
int ExistEchoNumbers(const char *echoNumbers)
double DefaultDataSpacing[3]
std::vector< std::string > SeriesInstanceUIDs
void GroupFiles(int idxSeriesInstanceUID, int idxContentTime, int idxTriggerTime, int idxEchoNumbers, int idxDiffusionGradientOrientation, int idxSliceLocation, int idxImageOrientationPatient)
static bool ReadMeasurementFrameMatrixFromMetaDataDictionary(const itk::MetaDataDictionary &dictionary, vtkMatrix4x4 *measurementFrameMatrix)
void SetSelectedEchoNumbers(int v)
const char * GetNthEchoNumbers(unsigned int n)
std::vector< std::pair< double, int > > FileNameSliceKey
int GetSelectedTriggerTime()
virtual void SetOutputScalarTypeToUnsignedShort()
unsigned int GetNumberOfSliceLocation()
unsigned int GetNumberOfSeriesInstanceUIDs()
get number of certain discriminators in the directory
void SetDesiredCoordinateOrientationToCoronal()
int GetSelectedOrientation()
int ExistDiffusionGradientOrientation(float *dgo)
int ExistContentTime(const char *contentTime)
vtkMatrix4x4 * GetMeasurementFrameMatrix()
Returns the Measurement frame matrix.
virtual void SetOutputScalarTypeToChar()
itk::ImageIOBase::Pointer GetImageIO(const char *filename)
Get the image IO for the specified filename.
float * GetNthImagePositionPatient(unsigned int n)
int InsertNextSliceLocation()
std::vector< std::string > AllFileNames
void SetDICOMImageIOApproachToGDCM()
int InsertImagePositionPatient(float *a)
const char * GetFileName(unsigned int n)
float * GetNthDiffusionGradientOrientation(unsigned int n)
const std::vector< std::string > & GetFileNames()
Return all the file names.
void SetSelectedSlice(int v)
std::vector< double > MetaDataScalarRangeMaxima
void SetDICOMImageIOApproachToDCMTK()
std::vector< double > MetaDataScalarRangeMinima
const char * GetNthTriggerTime(unsigned int n)
int GetSelectedDiffusion()
int InsertImageOrientationPatient(float *a)
virtual void SetOutputScalarType(int)
Get the file format. Pixels are this type in the file.
virtual void SetOutputScalarTypeToLong()
virtual void SetOutputScalarTypeToShort()
std::vector< long int > IndexDiffusionGradientOrientation
int InsertContentTime(const char *aTime)
std::vector< long int > IndexSeriesInstanceUIDs
index of each dicom file into the above arrays
vtkITKArchetypeImageSeriesReader()
std::vector< long int > IndexSliceLocation