/usr/include/InsightToolkit/Utilities/DICOMSource.h is in libinsighttoolkit3-dev 3.20.1+git20120521-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 | /*=========================================================================
Program: DICOMParser
Module: DICOMSource.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 __DICOMSOURCE_H_
#define __DICOMSOURCE_H_
#ifdef _MSC_VER
#pragma warning ( disable : 4514 )
#pragma warning ( push, 3 )
#endif
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include "DICOMTypes.h"
#include "DICOMConfig.h"
namespace DICOMPARSER_NAMESPACE
{
//
// Abstraction of a DICOM data source used by the DICOMParser.
//
class DICOM_EXPORT DICOMSource
{
public:
DICOMSource();
virtual ~DICOMSource();
//
// Return the position in the source
//
virtual long Tell()=0;
//
// Move to a particular position in the source.
//
virtual void SkipToPos(long)=0;
//
// Return the size of the source.
//
virtual long GetSize()=0;
//
// Skip a number of bytes.
//
virtual void Skip(long)=0;
//
// Skip to the beginning of the source.
//
virtual void SkipToStart()=0;
//
// Read data of length len.
//
virtual void Read(void* data, long len)=0;
//
// Read a double byte of data.
//
virtual doublebyte ReadDoubleByte();
virtual doublebyte ReadDoubleByteAsLittleEndian();
//
// Read a quadbyte of data.
//
virtual quadbyte ReadQuadByte();
//
// Read nbytes of data up to 4 bytes.
//
virtual quadbyte ReadNBytes(int len);
//
// Read a float an ascii.
//
virtual float ReadAsciiFloat(int len);
//
// Read an int as ascii.
//
virtual int ReadAsciiInt(int len);
//
// Read an array of ascii characters.
//
virtual char* ReadAsciiCharArray(int len);
//
// Convert the data to signed long.
//
static long ReturnAsSignedLong(unsigned char* data, bool )
{
return *((quadbyte*) data);
}
//
// Convert the data to unsigned long.
//
static ulong ReturnAsUnsignedLong(unsigned char* data, bool )
{
return *((ulong*) data);
}
//
// Convert data to unsigned short.
//
static ushort ReturnAsUnsignedShort(unsigned char* data, bool )
{
return *((doublebyte*)data);
}
//
// Convert data to signed short.
//
static short int ReturnAsSignedShort(unsigned char* data, bool )
{
return *((short int*)data);
}
//
// Convert data to int.
//
static int ReturnAsInteger(unsigned char* data, bool)
{
return static_cast<int> (atoi((const char *)data));
}
static float ReturnAsFloat(unsigned char* data, bool)
{
return static_cast<float> (atof((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 swapShorts(ushort *ip, ushort *op, int count)
{
while (count)
{
*op++ = swapShort(*ip++);
count--;
}
}
//
// Swap the bytes in an array of unsigned longs.
//
static void swapLongs(ulong *ip, ulong *op, int count)
{
while (count)
{
*op++ = swapLong(*ip++);
count--;
}
}
//
// Swap the bytes in an unsigned short.
//
static ushort swapShort(ushort v)
{
return ushort((v << 8)
| (v >> 8));
}
//
// Swap the bytes in an unsigned long.
//
static ulong swapLong(ulong v)
{
return ulong( (v << 24)
| ( (v << 8) & 0x00ff0000 )
| ( (v >> 8) & 0x0000ff00 )
| (v >> 24) );
}
const char* GetPlatformEndian() {return this->PlatformEndian;}
protected:
DICOMSource(const DICOMSource&);
void operator=(const DICOMSource&);
//
// Flag for swaping bytes.
//
bool PlatformIsBigEndian;
//
// Platform endianness
//
const char* PlatformEndian;
private:
};
}
#ifdef _MSC_VER
#pragma warning ( pop )
#endif
#endif // __DICOMSOURCE_H_
|