ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkScancoImageIO.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18/*=========================================================================
19
20 Program: DICOM for VTK
21
22 Copyright (c) 2015 David Gobbi
23 All rights reserved.
24 See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.
25
26 This software is distributed WITHOUT ANY WARRANTY; without even
27 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
28 PURPOSE. See the above copyright notice for more information.
29
30=========================================================================*/
53#ifndef itkScancoImageIO_h
54#define itkScancoImageIO_h
55#include "IOScancoExport.h"
56
57
58#include <cstdio>
59#include <fstream>
60#include "itkImageIOBase.h"
62#include "itkScancoHeaderIO.h"
63
64namespace itk
65{
75class IOScanco_EXPORT ScancoImageIO : public ImageIOBase
76{
77public:
86
87 ITK_DISALLOW_COPY_AND_MOVE(ScancoImageIO);
88
94
96 itkNewMacro(Self);
97
99 itkOverrideGetNameOfClassMacro(ScancoImageIO);
100
107 bool
108 SupportsDimension(unsigned long dimension) override
109 {
110 if (dimension == 3)
111 {
112 return true;
113 }
114 return false;
115 }
116
117 /*-------- This part of the interfaces deals with reading data. ----- */
118
121 bool
122 CanReadFile(const char *) override;
123
125 void
127
129 void
130 Read(void * buffer) override;
131
132 /*-------- This part of the interfaces deals with writing data. ----- */
133
136 bool
137 CanWriteFile(const char *) override;
138
140 void
142
145 void
146 Write(const void * buffer) override;
147
148
149 bool
150 CanStreamRead() override
151 {
152 return false;
153 }
154
155 bool
156 CanStreamWrite() override
157 {
158 return false;
159 }
160
163 const char *
165 {
166 return this->m_HeaderData.m_Version;
167 }
168 void
169 SetVersion(const char * version)
170 {
171 std::snprintf(this->m_HeaderData.m_Version, sizeof(this->m_HeaderData.m_Version), "%s", version);
172 this->Modified();
173 }
174
175 const char *
177 {
178 return this->m_HeaderData.m_CalibrationData;
179 }
180 void
181 SetCalibrationData(const char * calibrationData)
182 {
183 std::snprintf(
184 this->m_HeaderData.m_CalibrationData, sizeof(this->m_HeaderData.m_CalibrationData), "%s", calibrationData);
185 this->Modified();
186 }
187
188 const char *
190 {
191 return this->m_HeaderData.m_RescaleUnits;
192 }
193 void
194 SetRescaleUnits(const char * rescaleUnits)
195 {
196 std::snprintf(this->m_HeaderData.m_RescaleUnits, sizeof(this->m_HeaderData.m_RescaleUnits), "%s", rescaleUnits);
197 this->Modified();
198 }
199
200 ScancoGetConstMacro(PatientIndex, int);
201 ScancoSetMacro(PatientIndex, int);
202
203 ScancoGetConstMacro(ScannerID, int);
204 ScancoSetMacro(ScannerID, int);
205
206 ScancoGetConstMacro(SliceThickness, double);
207 ScancoSetMacro(SliceThickness, double);
208
209 ScancoGetConstMacro(SliceIncrement, double);
210 ScancoSetMacro(SliceIncrement, double);
211
212 ScancoGetConstMacro(StartPosition, double);
213 ScancoSetMacro(StartPosition, double);
214
216 const double *
218 {
219 return this->m_HeaderData.m_DataRange.data();
220 }
221 void
222 SetDataRange(const double * dataRange)
223 {
224 this->m_HeaderData.m_DataRange[0] = dataRange[0];
225 this->m_HeaderData.m_DataRange[1] = dataRange[1];
226 }
227 void
228 SetDataRange(const std::vector<double> & dataRange)
229 {
230 if (dataRange.size() >= 2)
231 {
232 this->m_HeaderData.m_DataRange[0] = dataRange[0];
233 this->m_HeaderData.m_DataRange[1] = dataRange[1];
234 }
235 }
236
237 ScancoGetConstMacro(MuScaling, double);
238 ScancoSetMacro(MuScaling, double);
239
240 ScancoGetConstMacro(MuWater, double);
241 ScancoSetMacro(MuWater, double);
242
243 ScancoGetConstMacro(RescaleType, int);
244 ScancoSetMacro(RescaleType, int);
245
246 ScancoGetConstMacro(RescaleSlope, double);
247 ScancoSetMacro(RescaleSlope, double);
248
249 ScancoGetConstMacro(RescaleIntercept, double);
250 ScancoSetMacro(RescaleIntercept, double);
251
252 ScancoGetConstMacro(NumberOfSamples, int);
253 ScancoSetMacro(NumberOfSamples, int);
254
255 ScancoGetConstMacro(NumberOfProjections, int);
256 ScancoSetMacro(NumberOfProjections, int);
257
258 ScancoGetConstMacro(ScanDistance, double);
259 ScancoSetMacro(ScanDistance, double);
260
261 ScancoGetConstMacro(ScannerType, int);
262 ScancoSetMacro(ScannerType, int);
263
264 ScancoGetConstMacro(SampleTime, double);
265 ScancoSetMacro(SampleTime, double);
266
267 ScancoGetConstMacro(MeasurementIndex, int);
268 ScancoSetMacro(MeasurementIndex, int);
269
271 ScancoSetMacro(Site, int);
272
273 ScancoGetConstMacro(ReferenceLine, int);
274 ScancoSetMacro(ReferenceLine, int);
275
276 ScancoGetConstMacro(ReconstructionAlg, int);
277 ScancoSetMacro(ReconstructionAlg, int);
278
281 const char *
283 {
284 return this->m_HeaderData.m_PatientName;
285 }
286 void
287 SetPatientName(const char * patientName)
288 {
289 std::snprintf(this->m_HeaderData.m_PatientName, sizeof(this->m_HeaderData.m_PatientName), "%s", patientName);
290 this->Modified();
291 }
292
293 const char *
295 {
296 return this->m_HeaderData.m_CreationDate;
297 }
298 void
299 SetCreationDate(const char * creationDate)
300 {
301 std::snprintf(this->m_HeaderData.m_CreationDate, sizeof(this->m_HeaderData.m_CreationDate), "%s", creationDate);
302 this->Modified();
303 }
304
305 const char *
307 {
308 return this->m_HeaderData.m_ModificationDate;
309 }
310 void
311 SetModificationDate(const char * modificationDate)
312 {
313 std::snprintf(
314 this->m_HeaderData.m_ModificationDate, sizeof(this->m_HeaderData.m_ModificationDate), "%s", modificationDate);
315 this->Modified();
316 }
317
318 ScancoGetConstMacro(Energy, double);
319 ScancoSetMacro(Energy, double);
320
321 ScancoGetConstMacro(Intensity, double);
322 ScancoSetMacro(Intensity, double);
323
324protected:
326 ~ScancoImageIO() override;
327
328 void
329 PrintSelf(std::ostream & os, Indent indent) const override;
330
331private:
333 template <typename TBufferType>
334 void
335 RescaleToHU(TBufferType * buffer, size_t size);
336
342 template <typename TBufferType>
343 void
344 RescaleToScanco(TBufferType * buffer, size_t size);
345
346 void
348
349 void
351
352 void
354
355 void
357
362 void
364
366 void
368
370
372
374
375 // The compression mode, if any.
377
379
381};
382} // end namespace itk
383
384#endif // itkScancoImageIO_h
itk::SizeValueType SizeValueType
Control indentation during Print() invocation.
Definition itkIndent.h:53
virtual void Modified() const
Read Scanco image headers.
Read Scanco image file formats.
ScancoGetConstMacro(ReconstructionAlg, int)
ScancoGetConstMacro(SliceIncrement, double)
bool CanWriteFile(const char *) override
void PopulateMetaDataDictionary()
SizeValueType m_HeaderSize
SmartPointer< Self > Pointer
ScancoHeaderIO * m_HeaderIO
ScancoSetMacro(RescaleType, int)
void SetModificationDate(const char *modificationDate)
void SetPatientName(const char *patientName)
ScancoGetConstMacro(PatientIndex, int)
ScancoGetConstMacro(RescaleSlope, double)
void WriteImageInformation() override
const char * GetVersion() const
ScancoSetMacro(MuWater, double)
ScancoGetConstMacro(ScannerType, int)
bool SupportsDimension(unsigned long dimension) override
const double * GetDataRange() const
ScancoSetMacro(PatientIndex, int)
ScancoSetMacro(RescaleIntercept, double)
ScancoGetConstMacro(SampleTime, double)
void SetCreationDate(const char *creationDate)
ScancoFileExtensions m_FileExtension
void SetHeaderFromMetaDataDictionary()
ScancoSetMacro(ScannerID, int)
ScancoGetConstMacro(StartPosition, double)
bool CanStreamWrite() override
void SetDataRange(const double *dataRange)
ScancoSetMacro(SliceIncrement, double)
const char * GetCreationDate() const
void ReadImageInformation() override
ScancoSetMacro(Site, int)
ScancoGetConstMacro(Energy, double)
itkScancoHeaderData m_HeaderData
void Read(void *buffer) override
void SetVersion(const char *version)
void SetDataRange(const std::vector< double > &dataRange)
ScancoGetConstMacro(MeasurementIndex, int)
ScancoSetMacro(SliceThickness, double)
ScancoSetMacro(ScannerType, int)
void PrintSelf(std::ostream &os, Indent indent) const override
bool CanStreamRead() override
void SetCalibrationData(const char *calibrationData)
const char * GetRescaleUnits() const
ScancoGetConstMacro(MuWater, double)
void SetDataTypeFromComponentEnum()
ScancoSetMacro(MuScaling, double)
const char * GetCalibrationData() const
SmartPointer< const Self > ConstPointer
ScancoGetConstMacro(MuScaling, double)
void SetRescaleUnits(const char *rescaleUnits)
ScancoSetMacro(Energy, double)
ScancoGetConstMacro(SliceThickness, double)
ScancoSetMacro(ReconstructionAlg, int)
ScancoGetConstMacro(RescaleIntercept, double)
ScancoGetConstMacro(NumberOfSamples, int)
ScancoGetConstMacro(NumberOfProjections, int)
ScancoSetMacro(SampleTime, double)
ScancoSetMacro(RescaleSlope, double)
~ScancoImageIO() override
ScancoSetMacro(NumberOfProjections, int)
ScancoSetMacro(MeasurementIndex, int)
ScancoSetMacro(Intensity, double)
ScancoGetConstMacro(ReferenceLine, int)
ScancoGetConstMacro(Site, int)
void RescaleToHU(TBufferType *buffer, vcl_size_t size)
void ParseAIMComponentType(int dataType)
void RescaleToScanco(TBufferType *buffer, vcl_size_t size)
void Write(const void *buffer) override
ScancoSetMacro(ReferenceLine, int)
ScancoGetConstMacro(ScanDistance, double)
ScancoGetConstMacro(ScannerID, int)
const char * GetModificationDate() const
bool CanReadFile(const char *) override
const char * GetPatientName() const
ScancoGetConstMacro(RescaleType, int)
ScancoSetMacro(ScanDistance, double)
ScancoSetMacro(StartPosition, double)
ScancoSetMacro(NumberOfSamples, int)
ScancoGetConstMacro(Intensity, double)
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....