12#ifndef __vtkvmtkITKArchetypeImageSeriesReader_h
13#define __vtkvmtkITKArchetypeImageSeriesReader_h
19#include "vtkImageAlgorithm.h"
23#include "itkMetaDataDictionary.h"
24#include "itkSpatialOrientation.h"
48 void PrintSelf(std::ostream& os, vtkIndent indent)
override;
50#if (ITK_VERSION_MAJOR >= 5)
115#if (ITK_VERSION_MAJOR >= 5)
117 itk::SpatialOrientationEnums::ValidCoordinateOrientations::ITK_COORDINATE_ORIENTATION_RAI;
120 itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI;
128#if (ITK_VERSION_MAJOR >= 5)
130 itk::SpatialOrientationEnums::ValidCoordinateOrientations::ITK_COORDINATE_ORIENTATION_RSA;
133 itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RSA;
142#if (ITK_VERSION_MAJOR >= 5)
143 itk::SpatialOrientationEnums::ValidCoordinateOrientations::ITK_COORDINATE_ORIENTATION_ASL;
145 itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ASL;
433 if ( this->
ContentTime[k].find(contentTime) != std::string::npos )
445 if ( this->
TriggerTime[k].find(triggerTime) != std::string::npos )
457 if ( this->
EchoNumbers[k].find(echoNumbers) != std::string::npos )
468 for (
int n = 0; n < 3; n++)
477 for (
int n = 0; n < 3; n++)
480 c += this->DiffusionGradientOrientation[k][n] * dgo[n];
482 c = std::fabs(c)/std::sqrt(a*b);
494 std::vector<float>::iterator iter =
495 std::find(this->
SliceLocation.begin(), this->SliceLocation.end(), sliceLocation);
503 float a = std::sqrt( directionCosine[0]*directionCosine[0] + directionCosine[1]*directionCosine[1] + directionCosine[2]*directionCosine[2] );
504 for (
int k = 0; k < 3; k++)
506 directionCosine[k] /= a;
508 a = std::sqrt( directionCosine[3]*directionCosine[3] + directionCosine[4]*directionCosine[4] + directionCosine[5]*directionCosine[5] );
509 for (
int k = 3; k < 6; k++)
511 directionCosine[k] /= a;
517 a = std::sqrt( aVec[0]*aVec[0] + aVec[1]*aVec[1] + aVec[2]*aVec[2] );
518 float b = (directionCosine[0]*aVec[0] + directionCosine[1]*aVec[1] + directionCosine[2]*aVec[2])/a;
524 a = std::sqrt( aVec[3]*aVec[3] + aVec[4]*aVec[4] + aVec[5]*aVec[5] );
525 b = (directionCosine[3]*aVec[3] + directionCosine[4]*aVec[4] + directionCosine[5]*aVec[5])/a;
537 for (
int n = 0; n < 3; n++)
546 for (
int n = 0; n < 3; n++)
549 c += this->ImagePositionPatient[k][n] * ipp[n];
551 c = std::fabs(c)/std::sqrt(a*b);
603 float *dgo =
new float [3];
604 for (
int k = 0; k <3; k++)
626 float *dgo =
new float [6];
627 for (
int k = 0; k <6; k++)
640 float *ipp =
new float [3];
641 for (
int k = 0; k <3; k++)
658 std::string aVector(aUID);
671 std::string aVector(aTime);
684 std::string aVector(aTime);
697 std::string aVector(aEcho);
709 std::vector< float > aVector(3);
710 float aMag = std::sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);
711 for (k = 0; k < 3; k++)
713 aVector[k] = a[k]/aMag;
751 std::vector< float > aVector(6);
752 float aMag = std::sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);
753 float bMag = std::sqrt(a[3]*a[3]+a[4]*a[4]+a[5]*a[5]);
754 for (k = 0; k < 3; k++)
756 aVector[k] = a[k]/aMag;
757 aVector[k+3] = a[k+3]/bMag;
772 std::vector< float > aVector(3);
773 for (
unsigned int i = 0; i < 3; i++ ) aVector[i] = a[i];
778 void AnalyzeDicomHeaders( );
780 void AssembleNthVolume(
int n );
781 int AssembleVolumeContainingArchetype();
783 void GroupFiles (
int idxSeriesInstanceUID,
787 int idxDiffusionGradientOrientation,
788 int idxSliceLocation,
789 int idxImageOrientationPatient );
791 const char* GetNthFileName (
int idxSeriesInstanceUID,
795 int idxDiffusionGradientOrientation,
796 int idxSliceLocation,
797 int idxImageOrientationPatient,
843 virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
override;
Read a series of files that have a common naming convention.
itk::SpatialOrientation::ValidCoordinateOrientationFlags CoordinateOrientationCode
void SetDesiredCoordinateOrientationToCoronal()
vtkvmtkITKArchetypeImageSeriesReader()
unsigned int GetNumberOfSliceLocation()
double DefaultDataOrigin[3]
virtual void SetOutputScalarType(int)
Get the file format. Pixels are this type in the file.
unsigned int GetNumberOfImagePositionPatient()
void SetSelectedContentTime(int v)
unsigned int GetNumberOfContentTime()
unsigned int GetNumberOfTriggerTime()
virtual void SetOutputScalarTypeToLong()
char UseNativeCoordinateOrientation
void PrintSelf(std::ostream &os, vtkIndent indent) override
void SetUseNativeOriginOff()
Use image center as origin.
int InsertNextSliceLocation()
float * GetNthImageOrientationPatient(unsigned int n)
double DefaultDataSpacing[3]
int InsertImageOrientationPatient(float *a)
const char * GetNthTriggerTime(unsigned int n)
void SetSelectedSlice(int v)
std::vector< float > SliceLocation
std::vector< std::pair< double, int > > FileNameSliceKey
int GetSelectedTriggerTime()
void SetGroupingByTagsOn()
virtual void SetOutputScalarTypeToUnsignedInt()
void SetSelectedUID(int v)
const itk::MetaDataDictionary & GetMetaDataDictionary() const
Return the MetaDataDictionary from the ITK layer.
const char * GetNthEchoNumbers(unsigned int n)
virtual void SetOutputScalarTypeToShort()
const char * GetNthSeriesInstanceUID(unsigned int n)
methods to get N-th discriminator
std::vector< long int > IndexSliceLocation
int InsertTriggerTime(const char *aTime)
std::vector< std::string > SeriesInstanceUIDs
virtual void SetOutputScalarTypeToInt()
int ExistContentTime(const char *contentTime)
std::vector< std::vector< float > > ImagePositionPatient
static vtkvmtkITKArchetypeImageSeriesReader * New()
unsigned int GetNumberOfEchoNumbers()
std::vector< std::string > TagValues
std::vector< std::string > TriggerTime
int ExistImageOrientationPatient(float *directionCosine)
float * GetNthImagePositionPatient(unsigned int n)
virtual void SetOutputScalarTypeToNative()
const char * GetNthContentTime(unsigned int n)
std::vector< long int > IndexEchoNumbers
int InsertSliceLocation(float a)
unsigned int IndexArchetype
std::vector< std::string > Tags
void SetDesiredCoordinateOrientationToSagittal()
int ExistSliceLocation(float sliceLocation)
virtual int CanReadFile(const char *filename)
is the given file name a NRRD file?
unsigned int GetNumberOfItemsInDictionary()
std::vector< std::string > AllFileNames
void SetDesiredCoordinateOrientationToAxial()
Set the orientation of the output image.
unsigned int GetNumberOfFileNames()
See how many file names were generated during ExecuteInformation.
const char * GetNthValue(unsigned int n)
int GetSelectedContentTime()
std::vector< std::string > FileNames
virtual void SetOutputScalarTypeToChar()
std::vector< std::string > EchoNumbers
std::vector< long int > IndexTriggerTime
unsigned int GetNumberOfImageOrientationPatient()
std::vector< long int > IndexDiffusionGradientOrientation
int GetSelectedEchoNumbers()
const char * GetNthKey(unsigned int n)
std::vector< long int > IndexImagePositionPatient
vtkMatrix4x4 * GetRasToIjkMatrix()
Returns an IJK to RAS transformation matrix.
void SetSelectedTriggerTime(int v)
void SetGroupingByTagsOff()
virtual void SetOutputScalarTypeToDouble()
int UseOrientationFromFile
void SetSelectedOrientation(int v)
virtual void SetOutputScalarTypeToUnsignedShort()
std::vector< std::vector< float > > DiffusionGradientOrientation
int ExistTriggerTime(const char *triggerTime)
vtkMatrix4x4 * RasToIjkMatrix
vtkMatrix4x4 * GetMeasurementFrameMatrix()
Returns the Measurement frame matrix.
bool GetGroupingByTags()
set/get functions for grouping by tags
std::vector< std::string > ContentTime
vtkMatrix4x4 * MeasurementFrameMatrix
int ExistImagePositionPatient(float *ipp)
void SetSelectedDiffusion(int v)
itk::MetaDataDictionary Dictionary
void SetDesiredCoordinateOrientationToNative()
int ExistDiffusionGradientOrientation(float *dgo)
int InsertDiffusionGradientOrientation(float *a)
CoordinateOrientationCode DesiredCoordinateOrientation
float GetNthSliceLocation(unsigned int n)
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
int GetSelectedOrientation()
int ExistSeriesInstanceUID(const char *SeriesInstanceUID)
check the existance of given discriminator
unsigned int GetNumberOfDiffusionGradientOrientation()
int InsertSeriesInstanceUIDs(const char *aUID)
unsigned int NumberOfComponents
std::vector< long int > IndexSeriesInstanceUIDs
index of each dicom file into the above arrays
const char * GetTagValue(char *tag)
virtual void SetOutputScalarTypeToUnsignedLong()
std::vector< long int > IndexImageOrientationPatient
void SetUseNativeOriginOn()
Use image origin from the file.
std::vector< long int > IndexContentTime
unsigned int GetNumberOfSeriesInstanceUIDs()
get number of certain discriminators in the directory
int InsertImagePositionPatient(float *a)
virtual void SetOutputScalarTypeToUnsignedChar()
int InsertEchoNumbers(const char *aEcho)
int InsertContentTime(const char *aTime)
void SetSelectedEchoNumbers(int v)
int ExistEchoNumbers(const char *echoNumbers)
int GetSelectedDiffusion()
unsigned int AddFileName(const char *filename)
virtual void SetOutputScalarTypeToFloat()
const std::vector< std::string > & GetFileNames()
Return all the file names.
float * GetNthDiffusionGradientOrientation(unsigned int n)
const char * GetFileName(unsigned int n)
std::vector< std::vector< float > > ImageOrientationPatient
Common include pulling in the Utilities/vtkvmtkITK module's Windows export-macro header; included by ...