SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkSiemensRdaReader.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_SIEMENS_RDA_READER_H
44 #define SVK_SIEMENS_RDA_READER_H
45 
46 
47 #include <vtkImageData.h>
48 #include <vtkInformation.h>
49 #include <vtkStringArray.h>
50 
51 #include <svkImageReader2.h>
52 #include <svkMRSIOD.h>
53 
54 #include <map>
55 #include <vector>
56 #include <string>
57 
58 
59 namespace svk {
60 
61 
79 {
80 
81  public:
82 
83  static svkSiemensRdaReader* New();
85 
86  // Description:
87  // A descriptive name for this format
88  virtual const char* GetDescriptiveName() {
89  return "Siemens RDA File";
90  }
91 
93  {
95  }
96 
97  // Methods:
98  virtual int CanReadFile(const char* fname);
99 
100 
101  protected:
102 
105 
106  virtual int FillOutputPortInformation(int port, vtkInformation* info);
107  virtual void ExecuteInformation();
108  virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation* outInfo);
110 
111 
112  private:
113 
114  // Methods:
115  virtual void InitDcmHeader();
116  void InitPatientModule();
117  void InitGeneralStudyModule();
118  void InitGeneralSeriesModule();
119  void InitGeneralEquipmentModule();
120  void InitMultiFrameFunctionalGroupsModule();
121  void InitMultiFrameDimensionModule();
122  void InitAcquisitionContextModule();
123  void InitMRSpectroscopyPulseSequenceModule();
124  void InitSharedFunctionalGroupMacros();
125  void InitPerFrameFunctionalGroupMacros();
126  void InitPixelMeasuresMacro();
127  void InitFrameContentMacro();
128  void InitPlanePositionMacro();
129  void InitPlaneOrientationMacro();
130  void InitMRSpectroscopyFrameTypeMacro();
131  void InitMRTimingAndRelatedParametersMacro();
132  void InitMRSpectroscopyFOVGeometryMacro();
133  void InitMREchoMacro();
134  void InitMRModifierMacro();
135  void InitMRReceiveCoilMacro();
136  void InitMRTransmitCoilMacro();
137  void InitMRAveragesMacro();
138  void InitMRSpatialSaturationMacro();
139  void InitMRSpatialVelocityEncodingMacro();
140  void InitMRSpectroscopyModule();
141  void InitVolumeLocalizationSeq();
142  void InitMRSpectroscopyDataModule();
143 
144  void ReadRdaFiles(vtkImageData* data);
145  int GetNumPixelsInVol();
146  string GetDcmPatientPositionString(string patientPosition);
147  void SetCellSpectrum( vtkImageData* data, int x, int y, int z, int timePt = 0, int coilNum = 0 );
148  void ParseRda();
149  int GetRdaKeyValuePair( );
150  int GetHeaderValueAsInt(string keyString, int valueIndex = 0);
151  float GetHeaderValueAsFloat(string keyString, int valueIndex = 0);
152  string GetHeaderValueAsString(string keyString, int valueIndex = 0);
153  void ParseAndSetStringElements(string key, string valueArrayString);
154  string GetStringFromFloat(float floatValue);
155  void PrintKeyValuePairs();
156  void MapDoubleValuesToFloat(double* specDataDbl, float* specData, int numVals);
157  void GetDcosFromRda(double dcos[3][3]);
158  void GetDcosFromRda(float dcos[3][3]);
159  float GetPPMRef();
160 
161 
162  // Members:
163  float* specData;
164  ifstream* rdaFile;
165  map <string, vector<string> > rdaMap;
166  long fileSize;
167  vtkStringArray* tmpFileNames;
168  int numSlices;
169  int numCoils;
170  int numTimePts;
172  svkMRSIOD* iod;
173  int endOfHeaderPos;
174 
175 };
176 
177 
178 } //svk
179 
180 
181 #endif //SVK_SIEMENS_RDA_READER_H
182 
Definition: svkImageReader2.h:60
virtual const char * GetDescriptiveName()
Definition: svkSiemensRdaReader.h:88
svkDcmHeader::DcmPixelDataFormat GetFileType()
Definition: svkSiemensRdaReader.cc:424
ReaderType
Definition: svkImageReader2.h:67
vtkTypeMacro(svkSiemensRdaReader, svkImageReader2)
virtual void ExecuteDataWithInformation(vtkDataObject *output, vtkInformation *outInfo)
Definition: svkSiemensRdaReader.cc:316
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Definition: svkSiemensRdaReader.cc:1680
DcmPixelDataFormat
Definition: svkDcmHeader.h:92
svkSiemensRdaReader()
Definition: svkSiemensRdaReader.cc:62
Definition: svkImageReader2.h:74
Definition: svkSiemensRdaReader.h:78
~svkSiemensRdaReader()
Definition: svkSiemensRdaReader.cc:91
virtual svkImageReader2::ReaderType GetReaderType()
Definition: svkSiemensRdaReader.h:92
virtual int CanReadFile(const char *fname)
Definition: svkSiemensRdaReader.cc:113
static svkSiemensRdaReader * New()
DcmDataOrderingDirection
Definition: svkDcmHeader.h:108
Definition: svkMRSIOD.h:61
virtual void ExecuteInformation()
Definition: svkSiemensRdaReader.cc:357