42 os << indent <<
"NormalDirectionConsistencySorter" << std::endl;
70 tags.push_back(
DICOMTag(0x0020, 0x0032) );
71 tags.push_back(
DICOMTag(0x0020, 0x0037) );
82 if (datasets.size() > 1)
104 bool hasOrientation(
false);
106 right, up, hasOrientation );
108 Point3D firstOrigin; firstOrigin.Fill(0.0f);
109 bool firstHasOrigin(
false);
112 Point3D lastOrigin; lastOrigin.Fill(0.0f);
113 bool lastHasOrigin(
false);
117 normal[0] = right[1] * up[2] - right[2] * up[1];
118 normal[1] = right[2] * up[0] - right[0] * up[2];
119 normal[2] = right[0] * up[1] - right[1] * up[0];
123 directionOfSlices = lastOrigin - firstOrigin;
124 directionOfSlices.Normalize();
126 double projection = normal * directionOfSlices;
128 MITK_DEBUG <<
"Making sense of \norientation '" << imageOrientationString
129 <<
"'\nfirst position '" << imagePositionPatientFirst
130 <<
"'\nlast position '" << imagePositionPatientLast <<
"'";
132 MITK_DEBUG <<
"Direction of slices: " << directionOfSlices;
133 MITK_DEBUG <<
"Projection of direction onto slice normal: " << projection;
135 if ( projection < 0.0 )
138 std::reverse( datasets.begin(), datasets.end() );
141 imagePositionPatientLast,
142 imagePositionPatientFirst,
143 imageOrientationString,
150 imagePositionPatientFirst,
151 imagePositionPatientLast,
152 imageOrientationString,
162 this->SetNumberOfOutputs(1);
163 this->SetOutput(0, datasets);
NormalDirectionConsistencySorter & operator=(const NormalDirectionConsistencySorter &other)
NormalDirectionConsistencySorter()
virtual ~NormalDirectionConsistencySorter()
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
std::vector< DICOMTag > DICOMTagList
void DICOMStringToOrientationVectors(const std::string &s, Vector3D &right, Vector3D &up, bool &successful)
Convert DICOM string describing a point two Vector3D.
Representation of a DICOM tag.
virtual void PrintConfiguration(std::ostream &os, const std::string &indent="") const override
Print configuration details into stream.
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
virtual DICOMTagList GetTagsOfInterest() override
virtual DICOMDatasetFinding GetTagValueAsString(const DICOMTag &tag) const =0
Return a DICOMDatasetFinding instance of the tag. The return containes (if valid) the raw value of th...
Makes sure that the order of files is along the image plane normals.
virtual void Sort() override
See class description.
GantryTiltInformation GetTiltInformation() const
See class description and DICOMITKSeriesGDCMReader.
virtual bool operator==(const DICOMDatasetSorter &other) const override
Point3D DICOMStringToPoint3D(const std::string &s, bool &successful)
Convert DICOM string describing a point to Point3D.
DICOMDatasetSorter & operator=(const DICOMDatasetSorter &other)
std::vector< DICOMDatasetAccess * > DICOMDatasetList