]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/kernel/include/marSimpleDicom.h
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / kernel / include / marSimpleDicom.h
1 /*=========================================================================
2
3  Program:   wxMaracas
4  Module:    $RCSfile: marSimpleDicom.h,v $
5  Language:  C++
6  Date:      $Date: 2009/05/14 13:55:08 $
7  Version:   $Revision: 1.1 $
8  
9   Copyright: (c) 2002, 2003
10   License:
11   
12    This software is distributed WITHOUT ANY WARRANTY; without even 
13    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14    PURPOSE.  See the above copyright notice for more information.
15    
16 =========================================================================*/
17
18 #ifndef __MAR__KERNEL__MARSIMPLEDICOM__HXX__
19 #define __MAR__KERNEL__MARSIMPLEDICOM__HXX__
20
21 #include "marDicomBase.h"
22
23 #include "volume.hxx"
24 #include <wx/string.h>
25 #include <wx/gauge.h>
26 // PS -> #include <gdcm.h>
27 // PS -> #include <gdcmHeaderHelper.h>
28 #include <vector>
29 // PS -> #include <gdcmElValSet.h>
30
31 typedef std::vector<wxArrayString> SerieInfo;  //DICOM info for each serie
32                                                                                            /**
33 * Shouldn't we break the dependencies to wx ???
34
35 * We use vector instead of list for efficiency: for access time
36 * futhermore the number of patient is not changing a lot, so we 
37 * might add the number of patient to params.dat, to allocate the right 
38 * number of vector
39 *
40 */
41
42 // EED Borrame 
43 //class MAR_KERNEL_EXPORT marGdcmDicom : public marObject
44
45 class marSimpleDicom : public marFilesBase
46 {
47 public:
48         
49     enum DicomTags
50     {
51                 ID_File_Name = 0                   ,
52                         ID_SOP_Class_UID                   ,//!0008 0016 UI ID SOP Class UID
53                         ID_SOP_Instance_UID                ,//!0008 0018 UI ID SOP Instance UID
54                         ID_Study_Date                      ,//!0008 0020 DA ID Study Date
55                         ID_Series_Date                     ,//!0008 0021 DA ID Series Date
56                         ID_Acquisition_Date                ,//!0008 0022 DA ID Acquisition Date
57                         ID_Image_Date                      ,//!0008 0023 DA ID Image Date
58                         ID_Study_Time                      ,//!0008 0030 TM ID Study Time
59                         ID_Series_Time                     ,//!0008 0031 TM ID Series Time
60                         ID_Acquisition_Time                ,//!0008 0032 TM ID Acquisition Time
61                         ID_Image_Time                      ,//!0008 0033 TM ID Image Time
62                         ID_Modality                        ,//!0008 0060 CS ID Modality
63                         ID_Manufacturer                    ,//!0008 0070 LO ID Manufacturer
64                         ID_Institution_Name                ,//!0008 0080 LO ID Institution Name
65                         ID_Study_Description               ,//!0008 1030 LO ID Study Description
66                         ID_Series_Description              ,//!0008 103e LO ID Series Description
67                         ID_Admitting_Diagnoses_Description ,//!0008 1080 LO ID Admitting Diagnoses Description
68                         ID_Patient_Name                    ,//!0010 0010 PN PAT Patient Name
69                         ID_Patient_ID                      ,//!0010 0020 LO PAT Patient ID
70                         ID_Body_Part_Examined              ,//!0018 0015 CS ACQ Body Part Examined
71                         ID_Scanning_Sequence               ,//!0018 0020 CS ACQ Scanning Sequence
72                         ID_Sequence_Variant                ,//!0018 0021 CS ACQ Sequence Variant
73                         ID_Scan_Options                    ,//!0018 0022 CS ACQ Scan Options
74                         ID_MR_Acquisition_Type             ,//!0018 0023 CS ACQ MR Acquisition Type
75                         ID_Sequence_Name                   ,//!0018 0024 SH ACQ Sequence Name
76                         ID_Slice_Thickness                 ,//!0018 0050 DS ACQ Slice Thickness
77                         ID_Repetition_Time                 ,//!0018 0080 DS ACQ Repetition Time
78                         ID_Echo_Time                       ,//!0018 0081 DS ACQ Echo Time
79                         ID_Inversion_Time                  ,//!0018 0082 DS ACQ Inversion Time
80                         ID_Number_of_Averages              ,//!0018 0083 DS ACQ Number of Averages
81                         ID_Imaging_Frequency               ,//!0018 0084 DS ACQ Imaging Frequency
82                         ID_Imaged_Nucleus                  ,//!0018 0085 SH ACQ Imaged Nucleus
83                         ID_Echo_Number                     ,//!0018 0086 IS ACQ Echo Number
84                         ID_Magnetic_Field_Strength         ,//!0018 0087 DS ACQ Magnetic Field Strength
85                         ID_Spacing_Between_Slices          ,//!0018 0088 DS ACQ Spacing Between Slices
86                         ID_Echo_Train_Length               ,//!0018 0091 IS ACQ Echo Train Length
87                         ID_Percent_Sampling                ,//!0018 0093 DS ACQ Percent Sampling
88                         ID_Percent_Phase_Field_of_View     ,//!0018 0094 DS ACQ Percent Phase Field of View
89                         ID_Receiving_Coil                  ,//!0018 1250 SH ACQ Receiving Coil
90                         ID_Patient_Position                ,//!0018 5100 CS ACQ Patient Position
91                         ID_Study_Instance_UID              ,//!0020 000d UI REL Study Instance UID
92                         ID_Series_Instance_UID             ,//!0020 000e UI REL Series Instance UID
93                         ID_Study_ID                        ,//!0020 0010 SH REL Study ID
94                         ID_Series_Number                   ,//!0020 0011 IS REL Series Number
95                         ID_Acquisition_Number              ,//!0020 0012 IS REL Acquisition Number
96                         ID_Image_Number                    ,//!0020 0013 IS REL Image Number
97                         ID_Patient_Orientation             ,//!0020 0020 CS REL Patient Orientation
98                         ID_Image_Position                  ,//!0020 0030 RET REL Image Position
99                         ID_Image_Position_Patient          ,//!0020 0032 DS REL Image Position Patient
100                         ID_Image_Orientation               ,//!0020 0035 RET REL Image Orientation
101                         ID_Image_Orientation_Patient       ,//!0020 0037 DS REL Image Orientation (Patient)
102                         ID_Location                        ,//!0020 0050 RET REL Location
103                         ID_Frame_of_Reference_UID          ,//!0020 0052 UI REL Frame of Reference UID
104                         ID_Slice_Location                  ,//!0020 1041 DS REL Slice Location
105                         ID_Image_Comments                  ,//!0020 4000 LT REL Image Comments
106                         ID_Pixel_Spacing                   ,//!0028 0030 DS IMG Pixel Spacing
107                         ID_Window_Center                   ,//!0028 1050 DS IMG Window Center
108                         ID_Window_Width                    ,//!0028 1051 DS IMG Window Width
109                         ID_dicom_tags_count
110     };
111         
112 public:
113         void SetVolumeData( int dimX,
114                                                 int dimY,
115                                                 int dimZ, 
116                                 float spacingX, 
117                                                 float spacingY, 
118                                                 float spacingZ, 
119                                                 float rescaleSlope,
120                                                 float rescaleIntercept,
121                                                 unsigned short * pixels);
122         
123     marSimpleDicom( marParameters* p = NULL );
124         
125     virtual ~marSimpleDicom( );
126         
127     /**
128         Function which return an *ordered* array string
129         The string is ordered so that filename are in the right order
130     */
131 // PS ->     wxArrayString getStudyInfo( ) { return( m_DicomInfo[m_ActualStudy][0] ); }
132 // PS ->     int getNumberOfStudies( ) { return m_DicomInfo.size(); }
133 // PS ->     wxArrayString getSerieInfo( ) { return( m_DicomInfo[m_ActualStudy][m_ActualSerie] ); }
134 // PS ->     int getNumberOfSeries( ) { return m_DicomInfo[m_ActualStudy].size(); }
135         
136         
137 // PS ->     int getNumberOfFiles( )
138 // PS ->     {
139 // PS ->                return m_DicomInfo[m_ActualStudy][m_ActualSerie].GetCount();
140 // PS ->     }
141         
142         void SetInvestSliceOrder(bool investSliceOrder);
143
144     void loadActualSerie(wxGauge* gauge );
145         
146 // PS ->     wxArrayString getImageNumbers( )
147 // PS ->     {
148 // PS ->                wxArrayString imageNumbers;
149 // PS ->                std::list<gdcmHeaderHelper*> flist = helper->GetGdcmFileList();
150 // PS ->                for(std::list<gdcmHeaderHelper*>::iterator it = flist.begin(); 
151 // PS ->                it != flist.end(); it++ )
152 // PS ->                {
153 // PS ->                        imageNumbers.Add( wxString::Format("%d", (*it)->GetImageNumber()) );
154 // PS ->                }
155 // PS ->                return( imageNumbers );
156 // PS ->     }
157
158         // PS ->     void loadVolume( bool force = false, wxGauge* gauge = NULL);
159     void loadVolumeDXMM( bool force = false, wxGauge* gauge = NULL);
160         
161 // PS ->        
162 // PS ->     bool setActualStudy( unsigned int studynumber )
163 // PS ->     {
164 // PS ->                m_ActualStudy = studynumber;
165 // PS ->                return true;
166 // PS ->     }
167 // PS ->     bool setActualSerie( unsigned int serienumber )
168 // PS ->     {
169 // PS ->                m_ActualSerie = serienumber;
170 // PS ->                return true;
171 // PS ->     }
172 // PS ->        
173     /** 
174         * General methods
175         */
176     void reset( );
177     void copyFrom( const marObject& from );
178         
179     /**
180         * Persistence methods
181         */
182     bool save( std::ofstream& os );
183     bool load( std::ifstream& is );
184         
185 // PS ->     void FillDicomInfo();
186     
187 // PS ->     wxString GetPatientName()
188 // PS ->        {
189 // PS ->                return wxString( helper->GetGdcmHeader()->GetPubElValByNumber(0x0010,0x0010).c_str()).Trim();//0010 0010 PN PAT Patient Name
190 // PS ->        }
191         
192   private:
193           
194 // PS ->          wxArrayString gdcmGetExamInfo( wxString directoryname );
195           
196           std::vector< SerieInfo > m_DicomInfo;
197           unsigned int m_ActualStudy;
198           unsigned int m_ActualSerie;
199           
200 // PS ->          gdcmSerieHeaderHelper *helper;
201           unsigned short * m_pSlicesPixels;
202           int   m_nX, m_nY, m_nSlices;
203           float m_PixelSpacingColumn,m_PixelSpacingRow,m_PixelSpacingSlice;
204           float m_RescaleSlope, m_RescaleIntercept;
205           bool  _investSliceOrder;
206 };
207
208 #endif // __MAR__KERNEL__MARSIMPLEDICOM__HXX__