comparison OrthancServer/DicomIntegerPixelAccessor.cpp @ 77:b8dfde8d64e8

new dicom tags
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Sep 2012 13:41:18 +0200
parents a70bb32802ae
children
comparison
equal deleted inserted replaced
76:e2d68529605f 77:b8dfde8d64e8
23 #ifndef NOMINMAX 23 #ifndef NOMINMAX
24 #define NOMINMAX 24 #define NOMINMAX
25 #endif 25 #endif
26 26
27 #include "../Core/OrthancException.h" 27 #include "../Core/OrthancException.h"
28 #include "FromDcmtkBridge.h"
29 #include <boost/lexical_cast.hpp> 28 #include <boost/lexical_cast.hpp>
30 #include <limits> 29 #include <limits>
31 30
32 namespace Orthanc 31 namespace Orthanc
33 { 32 {
33 static const DicomTag COLUMNS(0x0028, 0x0011);
34 static const DicomTag ROWS(0x0028, 0x0010);
35 static const DicomTag SAMPLES_PER_PIXEL(0x0028, 0x0002);
36 static const DicomTag BITS_ALLOCATED(0x0028, 0x0100);
37 static const DicomTag BITS_STORED(0x0028, 0x0101);
38 static const DicomTag HIGH_BIT(0x0028, 0x0102);
39 static const DicomTag PIXEL_REPRESENTATION(0x0028, 0x0103);
40
34 DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values, 41 DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values,
35 const void* pixelData, 42 const void* pixelData,
36 size_t size) : 43 size_t size) :
37 pixelData_(pixelData), 44 pixelData_(pixelData),
38 size_(size) 45 size_(size)
42 unsigned int highBit; 49 unsigned int highBit;
43 unsigned int pixelRepresentation; 50 unsigned int pixelRepresentation;
44 51
45 try 52 try
46 { 53 {
47 width_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "Columns").AsString()); 54 width_ = boost::lexical_cast<unsigned int>(values.GetValue(COLUMNS).AsString());
48 height_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "Rows").AsString()); 55 height_ = boost::lexical_cast<unsigned int>(values.GetValue(ROWS).AsString());
49 samplesPerPixel_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "SamplesPerPixel").AsString()); 56 samplesPerPixel_ = boost::lexical_cast<unsigned int>(values.GetValue(SAMPLES_PER_PIXEL).AsString());
50 bitsAllocated = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "BitsAllocated").AsString()); 57 bitsAllocated = boost::lexical_cast<unsigned int>(values.GetValue(BITS_ALLOCATED).AsString());
51 bitsStored = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "BitsStored").AsString()); 58 bitsStored = boost::lexical_cast<unsigned int>(values.GetValue(BITS_STORED).AsString());
52 highBit = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "HighBit").AsString()); 59 highBit = boost::lexical_cast<unsigned int>(values.GetValue(HIGH_BIT).AsString());
53 pixelRepresentation = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "PixelRepresentation").AsString()); 60 pixelRepresentation = boost::lexical_cast<unsigned int>(values.GetValue(PIXEL_REPRESENTATION).AsString());
54 } 61 }
55 catch (boost::bad_lexical_cast) 62 catch (boost::bad_lexical_cast)
56 { 63 {
57 throw OrthancException(ErrorCode_NotImplemented); 64 throw OrthancException(ErrorCode_NotImplemented);
58 } 65 }
59 66
60 frame_ = 0; 67 frame_ = 0;
61 try 68 try
62 { 69 {
63 numberOfFrames_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "NumberOfFrames").AsString()); 70 numberOfFrames_ = boost::lexical_cast<unsigned int>(values.GetValue(DicomTag::NUMBER_OF_FRAMES).AsString());
64 } 71 }
65 catch (OrthancException) 72 catch (OrthancException)
66 { 73 {
67 // If the tag "NumberOfFrames" is absent, assume there is a single frame 74 // If the tag "NumberOfFrames" is absent, assume there is a single frame
68 numberOfFrames_ = 1; 75 numberOfFrames_ = 1;