-
Notifications
You must be signed in to change notification settings - Fork 2
/
cfileloader.h
82 lines (62 loc) · 1.74 KB
/
cfileloader.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
#pragma once
/** C++ Includes **/
#include <string>
#include "dataobjects.h"
/** ITK Includes **/
#include <itkImageIOBase.h>
#include <itkImageIOFactory.h>
#include <itkImageFileReader.h>
#include <itkMetaDataObject.h>
#include <itkExtractImageFilter.h>
class CFileLoader
{
/** Data **/
private:
std::string m_FileName;
std::string m_FileDir;
InputImageType::Pointer m_FileImage3D;
InputImage4DType::Pointer m_FileImage4D;
InternalPixelDataType m_InternalPixelType;
double m_XYSliceOrientation[2];
bool m_FileLoaded;
bool m_RescaleData;
/** Constructors and Destructors **/
private:
CFileLoader();
public:
~CFileLoader() = default;
CFileLoader(const CFileLoader& rhs) = delete;
CFileLoader& operator =(const CFileLoader& rhs) = delete;
/** Function Members **/
public:
static CFileLoader* CreateNew()
{
return new CFileLoader();
}
bool isFileLoaded() const noexcept
{
return m_FileLoaded;
}
InputImageType::Pointer GetImage3D(unsigned int);
const InputImage4DType::Pointer& GetImage4D() const noexcept
{
return m_FileImage4D;
}
void OpenFile(const std::string&);
void Clean();
unsigned int Get4thDimension() const;
void GetImageXYOrientation(double *dir) const;
inline void RescaleDataOn() noexcept
{
m_RescaleData = true;
}
inline void RescaleDataOff() noexcept
{
m_RescaleData = false;
}
private:
bool CanITKRead(const std::string&);
InputImage4DType::Pointer ReadImage(const char *, InternalPixelDataType);
template<typename T>
InputImage4DType::Pointer InternalImageReader(const char *);
};