SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkIdfVolumeReader.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2009-2014 The Regents of the University of California.
3  * All Rights Reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * • Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * • Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * • None of the names of any campus of the University of California, the name
13  * "The Regents of the University of California," or the names of any of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
26  * OF SUCH DAMAGE.
27  */
28 
29 
30 
31 /*
32  * $URL$
33  * $Rev$
34  * $Author$
35  * $Date$
36  *
37  * Authors:
38  * Jason C. Crane, Ph.D.
39  * Beck Olson
40  */
41 
42 
43 #ifndef SVK_IDF_VOLUME_READER_H
44 #define SVK_IDF_VOLUME_READER_H
45 
46 #include <vtkInformation.h>
47 #include <map>
48 #include <vtkStringArray.h>
49 #include <string>
50 
51 #include <svkUtils.h>
52 #include <svkImageReader2.h>
53 #include <svkEnhancedMRIIOD.h>
54 
55 
56 namespace svk {
57 
58 
63 {
64 
65  public:
66 
67  static svkIdfVolumeReader* New();
69 
70 
71  typedef enum {
72  BYTE_DATA = 2,
73  INT2_DATA = 3,
75  } IDF_Data_Type;
76 
77  typedef enum {
81 
82 
83  // Description:
84  // A descriptive name for this format
85  virtual const char* GetDescriptiveName() {
86  return "IDF File";
87  }
88 
90  {
91  return svkImageReader2::IDF;
92  }
93 
95 
96  // Methods:
97  virtual int CanReadFile(const char* fname);
98  void SetReadIntAsSigned(bool readIntAsSigned);
99 
100  protected:
101 
104 
105  virtual int FillOutputPortInformation(int port, vtkInformation* info);
106  virtual void ExecuteInformation();
107  virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation* outInfo);
109 
110 
111  private:
112 
113  // Methods:
114  virtual void InitDcmHeader();
115  void InitPatientModule();
116  void InitGeneralStudyModule();
117  void InitGeneralSeriesModule();
118  void InitGeneralEquipmentModule();
119  void InitImagePixelModule();
120  void InitMultiFrameFunctionalGroupsModule();
121  void InitAcquisitionContextModule();
122  void InitSharedFunctionalGroupMacros();
123  void InitPerFrameFunctionalGroupMacros();
124  void InitFrameContentMacro();
125  void InitPlanePositionMacro();
126  void InitPixelMeasuresMacro();
127  void InitPlaneOrientationMacro();
128  void InitMRImagingModifierMacro();
129  void InitMRReceiveCoilMacro();
130  void InitMRTransmitCoilMacro();
131  void ReadVolumeFile();
132  int GetNumPixelsInVol();
133  int GetNumSlices();
134  void ParseIdfComment(
135  string comment,
136  string* PatientName,
137  string* seriesDescription,
138  string* studyDate
139  );
140  string GetDcmPatientPositionString(string patientPosition);
141  void ParseIdf();
142  void PrintKeyValuePairs();
143  bool IsIdfStudyIdAccessionNumber();
144 
145 
146 
147  // Members:
148  void* pixelData;
149  ifstream* volumeHdr;
150  map <string, string>
151  idfMap;
153  bool readIntAsSigned;
154  svkEnhancedMRIIOD* iod;
155  vtkStringArray* tmpFileNames;
156  int numFrames;
157  int numSlices;
158  int numVolumes;
159  svkIdfVolumeReader::MultiVolumeType multiVolumeType;
160 
161 };
162 
163 
164 } //svk
165 
166 
167 #endif //SVK_IDF_VOLUME_READER_H
168 
void SetMultiVolumeType(svkIdfVolumeReader::MultiVolumeType volumeType)
Definition: svkIdfVolumeReader.cc:144
virtual svkImageReader2::ReaderType GetReaderType()
Definition: svkIdfVolumeReader.h:89
Definition: svkImageReader2.h:60
Definition: svkIdfVolumeReader.h:62
Definition: svkIdfVolumeReader.h:74
ReaderType
Definition: svkImageReader2.h:67
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation *outInfo)
Definition: svkIdfVolumeReader.cc:291
virtual int CanReadFile(const char *fname)
Definition: svkIdfVolumeReader.cc:110
virtual const char * GetDescriptiveName()
Definition: svkIdfVolumeReader.h:85
vtkTypeMacro(svkIdfVolumeReader, svkImageReader2)
~svkIdfVolumeReader()
Definition: svkIdfVolumeReader.cc:91
DcmPixelDataFormat
Definition: svkDcmHeader.h:92
virtual svkDcmHeader::DcmPixelDataFormat GetFileType()
Definition: svkIdfVolumeReader.cc:415
virtual void ExecuteInformation()
Definition: svkIdfVolumeReader.cc:345
Definition: svkImageReader2.h:89
void SetReadIntAsSigned(bool readIntAsSigned)
Definition: svkIdfVolumeReader.cc:153
Definition: svkIdfVolumeReader.h:78
Definition: svkEnhancedMRIIOD.h:61
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Definition: svkIdfVolumeReader.cc:1092
static svkIdfVolumeReader * New()
Definition: svkIdfVolumeReader.h:73
Definition: svkIdfVolumeReader.h:79
DcmDataOrderingDirection
Definition: svkDcmHeader.h:108
svkIdfVolumeReader()
Definition: svkIdfVolumeReader.cc:61
Definition: svkIdfVolumeReader.h:72
MultiVolumeType
Definition: svkIdfVolumeReader.h:77
IDF_Data_Type
Definition: svkIdfVolumeReader.h:71