19 ,m_Group3DandT(m_DefaultGroup3DandT)
51 if (
const auto* otherSelf = dynamic_cast<const Self*>(&other))
83 return resultOf3DGrouping;
90 std::vector<unsigned int> true3DnTBlocksTimeStepCount;
94 const DICOMTag tagImagePositionPatient(0x0020, 0x0032);
96 while (!remainingBlocks.empty())
101 int current3DnTBlockNumberOfTimeSteps = 1;
104 const unsigned int currentBlockNumberOfSlices = firstBlock.size();
105 const std::string currentBlockFirstOrigin = firstBlock.front()->GetTagValueAsString( tagImagePositionPatient ).value;
106 const std::string currentBlockLastOrigin = firstBlock.back()->GetTagValueAsString( tagImagePositionPatient ).value;
108 remainingBlocks.erase( remainingBlocks.begin() );
111 for (
auto otherBlockIter = remainingBlocks.begin();
112 otherBlockIter != remainingBlocks.cend();
118 const unsigned int otherBlockNumberOfSlices = otherBlock.size();
119 const std::string otherBlockFirstOrigin = otherBlock.front()->GetTagValueAsString( tagImagePositionPatient ).value;
120 const std::string otherBlockLastOrigin = otherBlock.back()->GetTagValueAsString( tagImagePositionPatient ).value;
124 if ( otherBlockNumberOfSlices == currentBlockNumberOfSlices
125 && otherBlockFirstOrigin == currentBlockFirstOrigin
126 && otherBlockLastOrigin == currentBlockLastOrigin
129 ++current3DnTBlockNumberOfTimeSteps;
130 current3DnTBlock.insert( current3DnTBlock.end(), otherBlock.begin(), otherBlock.end() );
132 otherBlockIter = remainingBlocks.erase(otherBlockIter);
142 if (current3DnTBlockNumberOfTimeSteps > 1)
144 true3DnTBlocks.push_back(current3DnTBlock);
145 true3DnTBlocksTimeStepCount.push_back(current3DnTBlockNumberOfTimeSteps);
149 non3DnTBlocks.push_back(current3DnTBlock);
157 for (
auto blockIter = true3DnTBlocks.cbegin();
158 blockIter != true3DnTBlocks.cend();
163 assert(!gdcmFrameInfoList.empty());
175 assert(!frameList.empty());
181 block.SetImageFrameList( frameList );
182 block.SetTiltInformation( tiltInfo );
184 block.SetFlag(
"3D+t",
true);
185 block.SetIntProperty(
"timesteps", true3DnTBlocksTimeStepCount[o]);
186 MITK_DEBUG <<
"Found " << true3DnTBlocksTimeStepCount[o] <<
" timesteps";
191 return non3DnTBlocks;
201 for (
unsigned int o = 0; o < numberOfOutputs; ++o)
205 if (block.
GetFlag(
"3D+t",
false))
229 if (numberOfTimesteps == 1)
237 for (
int timeStep = 0; timeStep<numberOfTimesteps; ++timeStep)
241 auto timeStepStart = frames.cbegin() + timeStep * numberOfFramesPerTimestep;
242 auto timeStepEnd = frames.cbegin() + (timeStep+1) * numberOfFramesPerTimestep;
243 for (
auto frameIter = timeStepStart;
244 frameIter != timeStepEnd;
247 filenamesOfThisTimeStep.push_back( (*frameIter)->Filename );
249 filenamesPerTimestep.push_back( filenamesOfThisTimeStep );
virtual bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor &block) const
const GantryTiltInformation GetTiltInformation() const
Describe the gantry tilt of the acquisition.
mitk::DICOMImageBlockDescriptor::TagLookupTableToPropertyFunctor GetTagLookupTableToPropertyFunctor() const
bool operator==(const DICOMFileReader &other) const override
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT...
bool operator==(const DICOMFileReader &other) const override
void SetNumberOfOutputs(unsigned int numberOfOutputs)
Representation of a DICOM tag.
virtual AdditionalTagsMapType GetAdditionalTagsOfInterest() const
MITKDICOMREADER_EXPORT mitk::DICOMDatasetList ConvertToDICOMDatasetList(const DICOMDatasetAccessingImageFrameList &input)
void SetOutput(unsigned int index, const DICOMImageBlockDescriptor &output)
MITKDICOMREADER_EXPORT mitk::DICOMDatasetAccessingImageFrameList ConvertToDICOMDatasetAccessingImageFrameList(const DICOMDatasetList &input)
const DICOMImageFrameList & GetImageFrameList() const
List of frames that constitute the mitk::Image (DICOMImageFrames)
void PushLocale() const
Remember current locale on stack, activate "C" locale. "C" locale is required for correct parsing of ...
void SetMitkImage(Image::Pointer image)
The 3D mitk::Image that is loaded from the DICOM files of a DICOMImageFrameList.
unsigned int GetNumberOfOutputs() const
Number of outputs, only meaningful after calling AnalyzeInputFiles()
Image::Pointer Load3DnT(const StringContainerList &filenamesLists, bool correctTilt, const GantryTiltInformation &tiltInfo)
SortingBlockList Condense3DBlocks(SortingBlockList &) override
Analyze the groups produced by DICOMITKSeriesGDCMReader for 3D+t properties. This method tests whethe...
void PopLocale() const
Activate last remembered locale from locale stack "C" locale is required for correct parsing of numbe...
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
DICOMImageBlockDescriptor & InternalGetOutput(unsigned int index)
non-const access to the DICOMImageBlockDescriptor
void SetGroup3DandT(bool on)
Control whether 3D+t grouping shall actually be attempted.
Output descriptor for DICOMFileReader.
void SetTagCache(DICOMTagCache *privateCache)
bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor &block) const override
ThreeDnTDICOMSeriesReader & operator=(const ThreeDnTDICOMSeriesReader &other)
Extends DICOMITKSeriesGDCMReader by sorting/grouping into 3D+t image blocks.
bool LoadImages() override
Load via multiple calls to itk::ImageSeriesReader.
std::list< StringContainer > StringContainerList
virtual bool LoadMitkImageForOutput(unsigned int o)
Loads the mitk::Image by means of an itk::ImageSeriesReader.
static const bool m_DefaultGroup3DandT
bool GetGroup3DandT() const
ThreeDnTDICOMSeriesReader(unsigned int decimalPlacesForOrientation=Superclass::m_DefaultDecimalPlacesForOrientation)
std::vector< DICOMDatasetAccessingImageFrameList > SortingBlockList
MITKDICOMREADER_EXPORT mitk::DICOMImageFrameList ConvertToDICOMImageFrameList(const DICOMDatasetAccessingImageFrameList &input)
std::vector< DICOMDatasetAccessingImageFrameInfo::Pointer > DICOMDatasetAccessingImageFrameList
DICOMITKSeriesGDCMReader & operator=(const DICOMITKSeriesGDCMReader &other)
int GetNumberOfTimeSteps() const
std::vector< DICOMDatasetAccess * > DICOMDatasetList
Interface for DICOM readers that produce mitk::Images.
mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter
~ThreeDnTDICOMSeriesReader() override
virtual DICOMTagCache::Pointer GetTagCache() const
int GetNumberOfFramesPerTimeStep() const
bool GetFlag(const std::string &key, bool defaultValue) const
Convenience function around GetProperty()
std::vector< std::string > StringContainer