Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkDICOMITKSeriesGDCMReader.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkDICOMITKSeriesGDCMReader_h
14 #define mitkDICOMITKSeriesGDCMReader_h
15 
16 #include <mutex>
17 #include <stack>
18 #include "mitkDICOMFileReader.h"
19 #include "mitkDICOMDatasetSorter.h"
23 #include "MitkDICOMExports.h"
24 
25 
26 namespace itk
27 {
28  class TimeProbesCollectorBase;
29 }
30 
31 namespace mitk
32 {
33 
191 {
192  public:
193 
196  itkFactorylessNewMacro( DICOMITKSeriesGDCMReader );
198  mitkNewMacro2Param( DICOMITKSeriesGDCMReader, unsigned int, bool );
199 
204  void AnalyzeInputFiles() override;
205 
206  // void AllocateOutputImages();
210  bool LoadImages() override;
211 
212  // re-implemented from super-class
213  bool CanHandleFile(const std::string& filename) override;
214 
218  virtual void AddSortingElement(DICOMDatasetSorter* sorter, bool atFront = false);
219 
220  typedef const std::list<DICOMDatasetSorter::ConstPointer> ConstSorterList;
221  ConstSorterList GetFreelyConfiguredSortingElements() const;
222 
226  void SetFixTiltByShearing(bool on);
227 
228  bool GetFixTiltByShearing() const;
229 
233  void SetAcceptTwoSlicesGroups(bool accept) const;
234  bool GetAcceptTwoSlicesGroups() const;
235 
239  void SetToleratedOriginOffsetToAdaptive(double fractionOfInterSliceDistanct = 0.3) const;
240 
244  void SetToleratedOriginOffset(double millimeters = 0.005) const;
245 
249  void SetSimpleVolumeReading(bool read)
250  {
251  m_SimpleVolumeReading = read;
252  };
253 
258  {
259  return m_SimpleVolumeReading;
260  };
261 
262  double GetToleratedOriginError() const;
263  bool IsToleratedOriginOffsetAbsolute() const;
264 
265  double GetDecimalPlacesForOrientation() const;
266 
267  bool operator==(const DICOMFileReader& other) const override;
268 
269  DICOMTagPathList GetTagsOfInterest() const override;
270 
272  {
273  return m_DefaultDecimalPlacesForOrientation;
274  }
275 
277  {
278  return m_DefaultSimpleVolumeImport;
279  }
280 
282  {
283  return m_DefaultFixTiltByShearing;
284  }
285 
286  protected:
287 
288  void InternalPrintConfiguration(std::ostream& os) const override;
289 
291  static std::string GetActiveLocale();
296  void PushLocale() const;
301  void PopLocale() const;
302 
303  const static int m_DefaultDecimalPlacesForOrientation = 5;
304  const static bool m_DefaultSimpleVolumeImport = false;
305  const static bool m_DefaultFixTiltByShearing = true;
306 
307  DICOMITKSeriesGDCMReader(unsigned int decimalPlacesForOrientation = m_DefaultDecimalPlacesForOrientation, bool simpleVolumeImport = m_DefaultSimpleVolumeImport);
308  ~DICOMITKSeriesGDCMReader() override;
309 
311  DICOMITKSeriesGDCMReader& operator=(const DICOMITKSeriesGDCMReader& other);
312 
313  typedef std::vector<DICOMDatasetAccessingImageFrameList> SortingBlockList;
318  virtual SortingBlockList Condense3DBlocks(SortingBlockList& resultOf3DGrouping);
319 
320  virtual DICOMTagCache::Pointer GetTagCache() const;
321  void SetTagCache( const DICOMTagCache::Pointer& ) override;
322 
324  static SortingBlockList InternalExecuteSortingStep(
325  unsigned int sortingStepIndex,
326  const DICOMDatasetSorter::Pointer& sorter,
327  const SortingBlockList& input);
328 
330  virtual bool LoadMitkImageForOutput(unsigned int o);
331 
332  virtual bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor& block) const;
333 
335  static ReaderImplementationLevel GetReaderImplementationLevel(const std::string sopClassUID);
336  private:
337 
339  void EnsureMandatorySortersArePresent(unsigned int decimalPlacesForOrientation, bool simpleVolumeImport = false);
340 
341  protected:
342 
343  // NOT nice, made available to ThreeDnTDICOMSeriesReader due to lack of time
344  bool m_FixTiltByShearing; // could be removed by ITKDICOMSeriesReader NOT flagging tilt unless requested to fix it!
345 
347 
348  private:
349 
350  SortingBlockList m_SortingResultInProgress;
351 
352  typedef std::list<DICOMDatasetSorter::Pointer> SorterList;
353  SorterList m_Sorter;
354 
355  protected:
356 
357  // NOT nice, made available to ThreeDnTDICOMSeriesReader and ClassicDICOMSeriesReader due to lack of time
358  mitk::EquiDistantBlocksSorter::Pointer m_EquiDistantBlocksSorter;
359 
360  mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter;
361 
362  private:
363 
364  static std::mutex s_LocaleMutex;
365 
366  mutable std::stack<std::string> m_ReplacedCLocales;
367  mutable std::stack<std::locale> m_ReplacedCinLocales;
368 
369  double m_DecimalPlacesForOrientation;
370 
371  DICOMTagCache::Pointer m_TagCache;
372  bool m_ExternalCache;
373 };
374 
375 }
376 
377 #endif
mitk::DICOMITKSeriesGDCMReader::SetSimpleVolumeReading
void SetSimpleVolumeReading(bool read)
Ignore all dicom tags that are non-essential for simple 3D volume import.
Definition: mitkDICOMITKSeriesGDCMReader.h:249
mitk::DICOMITKSeriesGDCMReader::GetDefaultDecimalPlacesForOrientation
static int GetDefaultDecimalPlacesForOrientation()
Definition: mitkDICOMITKSeriesGDCMReader.h:271
mitk::DICOMTagPathList
std::vector< DICOMTagPath > DICOMTagPathList
Definition: mitkDICOMTagPath.h:155
mitk::DICOMImageBlockDescriptor
Output descriptor for DICOMFileReader.
Definition: mitkDICOMImageBlockDescriptor.h:77
mitkNewMacro2Param
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:81
mitk::DICOMITKSeriesGDCMReader::SortingBlockList
std::vector< DICOMDatasetAccessingImageFrameList > SortingBlockList
Definition: mitkDICOMITKSeriesGDCMReader.h:313
mitkEquiDistantBlocksSorter.h
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::DICOMITKSeriesGDCMReader::GetDefaultFixTiltByShearing
static bool GetDefaultFixTiltByShearing()
Definition: mitkDICOMITKSeriesGDCMReader.h:281
MitkDICOMExports.h
mitkDICOMFileReader.h
mitkDICOMGDCMImageFrameInfo.h
mitk::DICOMITKSeriesGDCMReader::m_FixTiltByShearing
bool m_FixTiltByShearing
Definition: mitkDICOMITKSeriesGDCMReader.h:344
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::DICOMITKSeriesGDCMReader::GetSimpleVolumeReading
bool GetSimpleVolumeReading()
Ignore all dicom tags that are non-essential for simple 3D volume import.
Definition: mitkDICOMITKSeriesGDCMReader.h:257
mitk::DICOMFileReader
Interface for DICOM readers that produce mitk::Images.
Definition: mitkDICOMFileReader.h:55
mitk::DICOMITKSeriesGDCMReader::m_NormalDirectionConsistencySorter
mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter
Definition: mitkDICOMITKSeriesGDCMReader.h:360
mitk::DICOMITKSeriesGDCMReader::m_EquiDistantBlocksSorter
mitk::EquiDistantBlocksSorter::Pointer m_EquiDistantBlocksSorter
Definition: mitkDICOMITKSeriesGDCMReader.h:358
mitkNormalDirectionConsistencySorter.h
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
mitk::ReaderImplementationLevel
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type (see mitk::DICOMFileReader).
Definition: mitkDICOMEnums.h:48
mitk::DICOMITKSeriesGDCMReader
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT,...
Definition: mitkDICOMITKSeriesGDCMReader.h:190
mitkDICOMDatasetSorter.h
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
mitkCloneMacro
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:154
mitk::DICOMITKSeriesGDCMReader::GetDefaultSimpleVolumeImport
static bool GetDefaultSimpleVolumeImport()
Definition: mitkDICOMITKSeriesGDCMReader.h:276
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
MITKDICOM_EXPORT
#define MITKDICOM_EXPORT
Definition: MitkDICOMExports.h:15
mitk::DICOMDatasetSorter
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
Definition: mitkDICOMDatasetSorter.h:40
mitk::DICOMITKSeriesGDCMReader::m_SimpleVolumeReading
bool m_SimpleVolumeReading
Definition: mitkDICOMITKSeriesGDCMReader.h:346
mitk::DICOMITKSeriesGDCMReader::ConstSorterList
const typedef std::list< DICOMDatasetSorter::ConstPointer > ConstSorterList
Definition: mitkDICOMITKSeriesGDCMReader.h:220