Geant4  10.03
DicomHandler.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: DicomHandler.hh 92820 2015-09-17 15:22:14Z gcosmo $
27 //
30 //
31 // The code was written by :
32 // *Louis Archambault louis.archambault@phy.ulaval.ca,
33 // *Luc Beaulieu beaulieu@phy.ulaval.ca
34 // +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
35 //
36 //
37 // *Centre Hospitalier Universitaire de Quebec (CHUQ),
38 // Hotel-Dieu de Quebec, departement de Radio-oncologie
39 // 11 cote du palais. Quebec, QC, Canada, G1R 2J6
40 // tel (418) 525-4444 #6720
41 // fax (418) 691 5268
42 //
43 // + Université Laval, Québec (QC) Canada
44 //*******************************************************//
45 
46 #ifndef DicomHandler_h
47 #define DicomHandler_h 1
48 
49 #include <cstdio>
50 #include <map>
51 #include <fstream>
52 
53 #include "globals.hh"
54 
55 //*******************************************************
66 //*******************************************************
67 
70 
72 {
73 public:
74 
75  DicomHandler();
76 
77  ~DicomHandler();
78 
79  // static accessor
80  static DicomHandler* Instance();
81 
82  G4int ReadFile(FILE *,char *);
83  G4int ReadData(FILE *,char *); // note: always use readHeader
84  // before readData
85 
86  // use ImageMagick to display the image
87  //G4int displayImage(char[500]);
88 
89  void CheckFileFormat();
90 
91 private:
92  template <class Type> void GetValue(char *, Type &);
93 
94 private:
96 
97  const int DATABUFFSIZE;
98  const int LINEBUFFSIZE;
99  const int FILENAMESIZE;
100 
101  void ReadCalibration();
102  void GetInformation(G4int &, char *);
103  G4float Pixel2density(G4int pixel);
104  void ReadMaterialIndices( std::ifstream& finData);
105  unsigned int GetMaterialIndex( G4float density );
106  void StoreData(std::ofstream& foutG4DCM);
107  void StoreData(DicomPhantomZSliceHeader* dcmPZSH);
109  void read_undefined_nested(FILE *);
110  void read_undefined_item(FILE *);
111 
114  short fRows;
115  short fColumns;
118 
122 
124 
127 
129  std::map<G4float,G4String> fMaterialIndices;
130 
136 
139 
140 };
141 #endif
142 
static DicomHandler * fInstance
DicomHandler.cc :
Definition: DicomHandler.hh:95
G4double fSliceLocation
void GetValue(char *, Type &)
G4int fMinPixelValue
float G4float
Definition: G4Types.hh:77
void read_undefined_nested(FILE *)
void GetInformation(G4int &, char *)
void ReadCalibration()
short fBitAllocated
const int DATABUFFSIZE
Definition: DicomHandler.hh:97
int G4int
Definition: G4Types.hh:78
G4String fCt2DensityFile
G4int fRescaleSlope
static DicomHandler * Instance()
Definition: DicomHandler.cc:72
G4bool fLittleEndian
G4int ** fTab
bool G4bool
Definition: G4Types.hh:79
DicomPhantomZSliceHeader class.
const int FILENAMESIZE
Definition: DicomHandler.hh:99
G4double fPixelSpacingX
bool fReadCalibration
unsigned int GetMaterialIndex(G4float density)
G4int ReadFile(FILE *, char *)
G4double * fValueCT
void StoreData(std::ofstream &foutG4DCM)
G4bool fImplicitEndian
G4double fSliceThickness
G4int ReadData(FILE *, char *)
G4double fPixelSpacingY
short fPixelRepresentation
G4String fDriverFile
G4double * fValueDensity
G4float Pixel2density(G4int pixel)
std::map< G4float, G4String > fMaterialIndices
void CheckFileFormat()
G4int fMaxPixelValue
void ReadMaterialIndices(std::ifstream &finData)
double G4double
Definition: G4Types.hh:76
const int LINEBUFFSIZE
Definition: DicomHandler.hh:98
G4int read_defined_nested(FILE *, G4int)
void read_undefined_item(FILE *)
G4int fRescaleIntercept
short fCompression
DicomPhantomZSliceMerged * fMergedSlices