/usr/include/vtk-5.8/DICOMFile.h is in libvtk5-dev 5.8.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /*=========================================================================
Program: DICOMParser
Module: DICOMFile.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2003 Matt Turek
All rights reserved.
See Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef __DICOMFILE_H_
#define __DICOMFILE_H_
#ifdef _MSC_VER
#pragma warning ( disable : 4514 )
#pragma warning ( push, 3 )
#endif
#ifdef __BORLANDC__
#pragma warn -8027 /* functions containing while are not expanded inline */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "DICOMTypes.h"
#include "DICOMConfig.h"
//
// Abstraction of a file used by the DICOMParser.
// This should probably be cleaned up so that it
// can be used to abstract a stream.
//
class DICOM_EXPORT DICOMFile
{
public:
DICOMFile();
virtual ~DICOMFile();
//
// Open a file with filename. Returns a bool
// that is true if the file is successfully
// opened.
//
bool Open(const dicom_stl::string& filename);
//
// Close a file.
//
void Close();
//
// Return the position in the file.
//
long Tell();
//
// Move to a particular position in the file.
//
void SkipToPos(long);
//
// Return the size of the file.
//
long GetSize();
//
// Skip a number of bytes.
//
void Skip(long);
//
// Skip to the beginning of the file.
//
void SkipToStart();
//
// Read data of length len.
//
void Read(void* data, long len);
//
// Read a double byte of data.
//
doublebyte ReadDoubleByte();
doublebyte ReadDoubleByteAsLittleEndian();
//
// Read a quadbyte of data.
//
quadbyte ReadQuadByte();
//
// Read nbytes of data up to 4 bytes.
//
quadbyte ReadNBytes(int len);
//
// Read a float an ascii.
//
float ReadAsciiFloat(int len);
//
// Read an int as ascii.
//
int ReadAsciiInt(int len);
//
// Read an array of ascii characters.
//
char* ReadAsciiCharArray(int len);
//
// Convert the data to signed long.
//
static int ReturnAsSignedLong(unsigned char* data, bool )
{
return *reinterpret_cast<quadbyte*>(data);
}
//
// Convert the data to unsigned long.
//
static uint ReturnAsUnsignedLong(unsigned char* data, bool)
{
return static_cast<uint>(*reinterpret_cast<ulong*>(data));
}
//
// Convert data to unsigned short.
//
static ushort ReturnAsUnsignedShort(unsigned char* data, bool)
{
return *reinterpret_cast<doublebyte*>(data);
}
//
// Convert data to signed short.
//
static short int ReturnAsSignedShort(unsigned char* data, bool)
{
return *reinterpret_cast<short int*>(data);
}
//
// Convert data to int.
//
static int ReturnAsInteger(unsigned char* data, bool)
{
return atoi(reinterpret_cast<const char*>(data));
}
static float ReturnAsFloat(unsigned char* data, bool)
{
return static_cast<float>(atof(reinterpret_cast<const char*>(data)));
}
bool GetPlatformIsBigEndian()
{
return PlatformIsBigEndian;
}
void SetPlatformIsBigEndian(bool v)
{
this->PlatformIsBigEndian = v;
}
//
// Swap the bytes in an array of unsigned shorts.
//
static void swap2(ushort *ip, ushort *op, int count)
{
while (count)
{
*op++ = swap2(*ip++);
count--;
}
}
//
// Swap the bytes in an array of unsigned longs.
//
static void swap4(uint *ip, uint *op, int count)
{
while (count)
{
*op++ = swap4(*ip++);
count--;
}
}
//
// Swap the bytes in an unsigned short.
//
static ushort swap2(ushort v)
{
return ushort((v << 8)
| (v >> 8));
}
//
// Swap the bytes in an unsigned long.
//
static uint swap4(uint v)
{
return uint((v << 24)
| ((v << 8) & 0x00ff0000)
| ((v >> 8) & 0x0000ff00)
| ((v >> 24)));
}
const char* GetPlatformEndian() {return this->PlatformEndian;}
protected:
//
// Internal storage for the filename.
//
// char* Filename;
//
// Internal storage for the file pointer.
//
// FILE* Fptr;
dicom_stream::ifstream InputStream;
//
// Flag for swaping bytes.
//
bool PlatformIsBigEndian;
//
// Platform endianness
//
const char* PlatformEndian;
private:
DICOMFile(const DICOMFile&);
void operator=(const DICOMFile&);
};
#ifdef _MSC_VER
#pragma warning ( pop )
#endif
#endif // __DICOMFILE_H_
|