Mercurial > hg > orthanc
comparison PalanthirServer/DicomIntegerPixelAccessor.cpp @ 50:a15e90e5d6fc
rename in code
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Sep 2012 15:50:12 +0200 |
parents | 33d67e1ab173 |
children | 293038baf8f1 |
comparison
equal
deleted
inserted
replaced
49:e1a3ae0dadf3 | 50:a15e90e5d6fc |
---|---|
1 /** | 1 /** |
2 * Palantir - A Lightweight, RESTful DICOM Store | 2 * Palanthir - A Lightweight, RESTful DICOM Store |
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, | 3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, |
4 * Belgium | 4 * Belgium |
5 * | 5 * |
6 * This program is free software: you can redistribute it and/or | 6 * This program is free software: you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License as | 7 * modify it under the terms of the GNU General Public License as |
22 | 22 |
23 #ifndef NOMINMAX | 23 #ifndef NOMINMAX |
24 #define NOMINMAX | 24 #define NOMINMAX |
25 #endif | 25 #endif |
26 | 26 |
27 #include "../Core/PalantirException.h" | 27 #include "../Core/PalanthirException.h" |
28 #include "FromDcmtkBridge.h" | 28 #include "FromDcmtkBridge.h" |
29 #include <boost/lexical_cast.hpp> | 29 #include <boost/lexical_cast.hpp> |
30 #include <limits> | 30 #include <limits> |
31 | 31 |
32 namespace Palantir | 32 namespace Palanthir |
33 { | 33 { |
34 DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values, | 34 DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values, |
35 const void* pixelData, | 35 const void* pixelData, |
36 size_t size) : | 36 size_t size) : |
37 pixelData_(pixelData), | 37 pixelData_(pixelData), |
52 highBit = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "HighBit").AsString()); | 52 highBit = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "HighBit").AsString()); |
53 pixelRepresentation = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "PixelRepresentation").AsString()); | 53 pixelRepresentation = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "PixelRepresentation").AsString()); |
54 } | 54 } |
55 catch (boost::bad_lexical_cast) | 55 catch (boost::bad_lexical_cast) |
56 { | 56 { |
57 throw PalantirException(ErrorCode_NotImplemented); | 57 throw PalanthirException(ErrorCode_NotImplemented); |
58 } | 58 } |
59 | 59 |
60 if (bitsAllocated != 8 && bitsAllocated != 16 && | 60 if (bitsAllocated != 8 && bitsAllocated != 16 && |
61 bitsAllocated != 24 && bitsAllocated != 32) | 61 bitsAllocated != 24 && bitsAllocated != 32) |
62 { | 62 { |
63 throw PalantirException(ErrorCode_NotImplemented); | 63 throw PalanthirException(ErrorCode_NotImplemented); |
64 } | 64 } |
65 | 65 |
66 if (bitsAllocated > 32 || | 66 if (bitsAllocated > 32 || |
67 bitsStored >= 32) | 67 bitsStored >= 32) |
68 { | 68 { |
69 // Not available, as the accessor internally uses int32_t values | 69 // Not available, as the accessor internally uses int32_t values |
70 throw PalantirException(ErrorCode_NotImplemented); | 70 throw PalanthirException(ErrorCode_NotImplemented); |
71 } | 71 } |
72 | 72 |
73 if (samplesPerPixel_ != 1) | 73 if (samplesPerPixel_ != 1) |
74 { | 74 { |
75 throw PalantirException(ErrorCode_NotImplemented); | 75 throw PalanthirException(ErrorCode_NotImplemented); |
76 } | 76 } |
77 | 77 |
78 if (width_ * height_ * bitsAllocated / 8 != size) | 78 if (width_ * height_ * bitsAllocated / 8 != size) |
79 { | 79 { |
80 throw PalantirException(ErrorCode_NotImplemented); | 80 throw PalanthirException(ErrorCode_NotImplemented); |
81 } | 81 } |
82 | 82 |
83 /*printf("%d %d %d %d %d %d %d\n", width_, height_, samplesPerPixel_, bitsAllocated, | 83 /*printf("%d %d %d %d %d %d %d\n", width_, height_, samplesPerPixel_, bitsAllocated, |
84 bitsStored, highBit, pixelRepresentation);*/ | 84 bitsStored, highBit, pixelRepresentation);*/ |
85 | 85 |
143 v = (v >> shift_) & mask_; | 143 v = (v >> shift_) & mask_; |
144 | 144 |
145 if (v & signMask_) | 145 if (v & signMask_) |
146 { | 146 { |
147 // Signed value: Not implemented yet | 147 // Signed value: Not implemented yet |
148 //throw PalantirException(ErrorCode_NotImplemented); | 148 //throw PalanthirException(ErrorCode_NotImplemented); |
149 v = 0; | 149 v = 0; |
150 } | 150 } |
151 | 151 |
152 return v; | 152 return v; |
153 } | 153 } |