forked from BRAINSia/BRAINSTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDWIDICOMConverterBase.h
102 lines (86 loc) · 2.99 KB
/
DWIDICOMConverterBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// Created by Johnson, Hans J on 11/24/16.
//
#ifndef BRAINSTOOLS_DWIDICOMCONVERTERBASE_H
#define BRAINSTOOLS_DWIDICOMCONVERTERBASE_H
#include <vector>
#include <iostream>
#include "DWIConverter.h"
#include "itkDCMTKSeriesFileNames.h"
#include "itkMacro.h"
#include "itkDCMTKImageIO.h"
#include "itkImage.h"
#include "itkDCMTKFileReader.h"
#include "itkNumberToString.h"
#include "DWIConvertUtils.h"
class DWIDICOMConverterBase : public DWIConverter
{
public:
using InputNamesGeneratorType = itk::DCMTKSeriesFileNames;
using DCMTKFileVector = std::vector< itk::DCMTKFileReader * >;
DWIDICOMConverterBase( const DCMTKFileVector & allHeaders, const FileNamesContainer & inputFileNames,
const bool useBMatrixGradientDirections );
/**
* @brief Return common fields. Does nothing for FSL
* @return empty map
*/
CommonDicomFieldMapType
GetCommonDicomFieldsMap() const override;
void
LoadFromDisk() override;
virtual void
LoadDicomDirectory();
double
readThicknessFromDicom() const;
int
getDicomSpacing( double * const spacing ) const;
protected:
enum VRType
{
DCM_CS,
DCM_LO,
DCM_SH,
DCM_DS,
};
/**
* @brief Create a dictionary of dicom extracted information about the scans
* using dcmtk dcm2xml tool, identify the information desired to be kept
* <element tag="0018,1314" vr="DS" vm="1" len="2" name="FlipAngle">90</element>
* @param dcm_primary_name "0018" in example above
* @param dcm_seconary_name "1314" in example above
* @param dcm_human_readable_name "FlipAngle" in example above
* @param vr "DCM_DS" for enumeration as indicated by vr in example above
*/
void
_addToStringDictionary( const std::string dcm_primary_name, const std::string dcm_seconary_name,
const std::string dcm_human_readable_name, const enum VRType vr );
/** the SliceOrderIS flag can be computed (as above) but if it's
* invariant, the derived classes can just set the flag. This method
* fixes up the VolumeDirectionCos after the flag is set.
*/
void
SetDirectionsFromSliceOrder();
/* given a sequence of dicom files where all the slices for location
* 0 are folled by all the slices for location 1, etc. This method
* transforms it into a sequence of volumes
*/
void
DeInterleaveVolume();
/* determine if slice order is inferior to superior */
void
DetermineSliceOrderIS();
/** force use of the BMatrix to compute gradients in Siemens data instead of
* the reported gradients. which are in many cases bogus.
*/
const bool m_UseBMatrixGradientDirections;
/** one file reader per DICOM file in dataset */
const DCMTKFileVector m_Headers;
/** matrix with just spacing information, used a couple places */
/** the current dataset is represented in a single file */
bool m_MultiSliceVolume;
/** slice order is inferior/superior? */
bool m_SliceOrderIS;
/** track if images is interleaved */
bool m_IsInterleaved;
};
#endif // BRAINSTOOLS_DWIDICOMCONVERTERBASE_H