Mercurial > hg > orthanc
comparison Core/DicomFormat/DicomIntegerPixelAccessor.cpp @ 800:ecedd89055db
generation of DICOM images from PNG files
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 May 2014 16:33:40 +0200 |
parents | 2d0a347e8cfc |
children | a811bdf8b8eb |
comparison
equal
deleted
inserted
replaced
799:777b6b694da6 | 800:ecedd89055db |
---|---|
42 #include <cassert> | 42 #include <cassert> |
43 #include <stdio.h> | 43 #include <stdio.h> |
44 | 44 |
45 namespace Orthanc | 45 namespace Orthanc |
46 { | 46 { |
47 static const DicomTag COLUMNS(0x0028, 0x0011); | |
48 static const DicomTag ROWS(0x0028, 0x0010); | |
49 static const DicomTag SAMPLES_PER_PIXEL(0x0028, 0x0002); | |
50 static const DicomTag BITS_ALLOCATED(0x0028, 0x0100); | |
51 static const DicomTag BITS_STORED(0x0028, 0x0101); | |
52 static const DicomTag HIGH_BIT(0x0028, 0x0102); | |
53 static const DicomTag PIXEL_REPRESENTATION(0x0028, 0x0103); | |
54 static const DicomTag PLANAR_CONFIGURATION(0x0028, 0x0006); | |
55 | |
56 DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values, | 47 DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values, |
57 const void* pixelData, | 48 const void* pixelData, |
58 size_t size) : | 49 size_t size) : |
59 pixelData_(pixelData), | 50 pixelData_(pixelData), |
60 size_(size) | 51 size_(size) |
65 unsigned int pixelRepresentation; | 56 unsigned int pixelRepresentation; |
66 planarConfiguration_ = 0; | 57 planarConfiguration_ = 0; |
67 | 58 |
68 try | 59 try |
69 { | 60 { |
70 width_ = boost::lexical_cast<unsigned int>(values.GetValue(COLUMNS).AsString()); | 61 width_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_COLUMNS).AsString()); |
71 height_ = boost::lexical_cast<unsigned int>(values.GetValue(ROWS).AsString()); | 62 height_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_ROWS).AsString()); |
72 samplesPerPixel_ = boost::lexical_cast<unsigned int>(values.GetValue(SAMPLES_PER_PIXEL).AsString()); | 63 samplesPerPixel_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_SAMPLES_PER_PIXEL).AsString()); |
73 bitsAllocated = boost::lexical_cast<unsigned int>(values.GetValue(BITS_ALLOCATED).AsString()); | 64 bitsAllocated = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_BITS_ALLOCATED).AsString()); |
74 bitsStored = boost::lexical_cast<unsigned int>(values.GetValue(BITS_STORED).AsString()); | 65 bitsStored = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_BITS_STORED).AsString()); |
75 highBit = boost::lexical_cast<unsigned int>(values.GetValue(HIGH_BIT).AsString()); | 66 highBit = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_HIGH_BIT).AsString()); |
76 pixelRepresentation = boost::lexical_cast<unsigned int>(values.GetValue(PIXEL_REPRESENTATION).AsString()); | 67 pixelRepresentation = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_PIXEL_REPRESENTATION).AsString()); |
77 | 68 |
78 if (samplesPerPixel_ > 1) | 69 if (samplesPerPixel_ > 1) |
79 { | 70 { |
80 // The "Planar Configuration" is only set when "Samples per Pixels" is greater than 1 | 71 // The "Planar Configuration" is only set when "Samples per Pixels" is greater than 1 |
81 // https://www.dabsoft.ch/dicom/3/C.7.6.3.1.3/ | 72 // https://www.dabsoft.ch/dicom/3/C.7.6.3.1.3/ |
82 planarConfiguration_ = boost::lexical_cast<unsigned int>(values.GetValue(PLANAR_CONFIGURATION).AsString()); | 73 planarConfiguration_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_PLANAR_CONFIGURATION).AsString()); |
83 } | 74 } |
84 } | 75 } |
85 catch (boost::bad_lexical_cast) | 76 catch (boost::bad_lexical_cast) |
86 { | 77 { |
87 throw OrthancException(ErrorCode_NotImplemented); | 78 throw OrthancException(ErrorCode_NotImplemented); |