source: trunk/examples/extended/medical/DICOM/include/DicomHandler.hh @ 812

Last change on this file since 812 was 807, checked in by garnier, 16 years ago

update

File size: 3.8 KB
Line 
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// The code was written by :
27//      *Louis Archambault louis.archambault@phy.ulaval.ca,
28//      *Luc Beaulieu beaulieu@phy.ulaval.ca
29//      +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
30//
31//
32// *Centre Hospitalier Universitaire de Quebec (CHUQ),
33// Hotel-Dieu de Quebec, departement de Radio-oncologie
34// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
35// tel (418) 525-4444 #6720
36// fax (418) 691 5268
37//
38// + Université Laval, Québec (QC) Canada
39//*******************************************************//
40
41//*******************************************************
42//
43// DicomHandler.hh :
44//      - Handling of DICM images
45//      - Transforming *.dcm to *.g4 ( pixels->density )
46//      - Reading headers and pixels
47//      - Transforming pixel to density and creating *.g4
48//        files
49//      - Functions are in DicomHandler.cc
50//
51//
52// Base on previous code by :
53//      Dragan Tubic <tdragan@gel.ulaval.ca>
54//*******************************************************
55
56#ifndef DicomHandler_h
57#define DicomHandler_h 1
58
59#include <cstdio>
60#include <map>
61#include <fstream>
62
63#include "globals.hh"
64
65class DicomHandler
66{
67public:
68
69  DicomHandler();
70
71    ~DicomHandler();
72
73  G4int ReadFile(FILE *,char *);
74  G4int ReadData(FILE *,char *); // note: always use readHeader
75                                    // before readData
76
77  // use ImageMagick to display the image
78  //G4int displayImage(char[500]);
79
80    void CheckFileFormat();
81
82private:
83    template <class Type> void GetValue(char *, Type &);
84
85private:
86
87    const int DATABUFFSIZE;
88    const int LINEBUFFSIZE;
89    const int FILENAMESIZE;
90
91    void GetInformation(G4int &, char *);
92    G4double Pixel2density(G4int pixel);
93    void ReadMaterialIndices( std::ifstream& finData);
94    size_t GetMaterialIndex( G4double density );
95    void StoreData(std::ofstream& foutG4DCM);
96
97    short compression;
98    G4int nFiles;
99    short rows;
100    short columns;
101    short bitAllocated;
102    G4int maxPixelValue, minPixelValue;
103   
104    G4double pixelSpacingX, pixelSpacingY;
105    G4double sliceThickness;
106    G4double sliceLocation;
107   
108    G4int rescaleIntercept, rescaleSlope;
109   
110    G4bool littleEndian, implicitEndian;
111    short pixelRepresentation;
112
113    G4int** tab;
114  std::map<G4double,G4String> fMaterialIndices;
115};
116#endif
117
Note: See TracBrowser for help on using the repository browser.