/src/dcmtk/dcmimage/libsrc/dicopx.cc
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * Copyright (C) 1996-2010, OFFIS e.V. |
4 | | * All rights reserved. See COPYRIGHT file for details. |
5 | | * |
6 | | * This software and supporting documentation were developed by |
7 | | * |
8 | | * OFFIS e.V. |
9 | | * R&D Division Health |
10 | | * Escherweg 2 |
11 | | * D-26121 Oldenburg, Germany |
12 | | * |
13 | | * |
14 | | * Module: dcmimage |
15 | | * |
16 | | * Author: Joerg Riesmeier |
17 | | * |
18 | | * Purpose: DicomColorPixel (Source) |
19 | | * |
20 | | */ |
21 | | |
22 | | |
23 | | #include "dcmtk/config/osconfig.h" |
24 | | #include "dcmtk/dcmdata/dctypes.h" |
25 | | #include "dcmtk/dcmdata/dcdeftag.h" |
26 | | |
27 | | #include "dcmtk/dcmimage/dicopx.h" |
28 | | #include "dcmtk/dcmimage/diqttype.h" |
29 | | #include "dcmtk/dcmimgle/dimopx.h" |
30 | | #include "dcmtk/dcmimgle/diinpx.h" |
31 | | #include "dcmtk/dcmimgle/didocu.h" |
32 | | |
33 | | |
34 | | /*----------------* |
35 | | * constructors * |
36 | | *----------------*/ |
37 | | |
38 | | DiColorPixel::DiColorPixel(const DiDocument *docu, |
39 | | const DiInputPixel *pixel, |
40 | | const Uint16 samples, |
41 | | EI_Status &status, |
42 | | const Uint16 sample_rate) |
43 | 0 | : DiPixel(0), |
44 | 0 | PlanarConfiguration(0) |
45 | 0 | { |
46 | 0 | if (docu != NULL) |
47 | 0 | { |
48 | 0 | Uint16 us = 0; |
49 | 0 | if (docu->getValue(DCM_SamplesPerPixel, us)) |
50 | 0 | { |
51 | 0 | if (us != samples) |
52 | 0 | { |
53 | 0 | DCMIMAGE_WARN("invalid value for 'SamplesPerPixel' (" << us |
54 | 0 | << ") ... assuming " << samples); |
55 | 0 | } |
56 | 0 | if (docu->getValue(DCM_PlanarConfiguration, us)) |
57 | 0 | { |
58 | | /* only use Planar Configuration attribute if there are multiple planes */ |
59 | 0 | if (samples > 1) |
60 | 0 | { |
61 | 0 | PlanarConfiguration = (us == 1); |
62 | 0 | if ((us != 0) && (us != 1)) |
63 | 0 | { |
64 | 0 | DCMIMAGE_WARN("invalid value for 'PlanarConfiguration' (" << us |
65 | 0 | << ") ... assuming 'color-by-pixel' (0)"); |
66 | 0 | } |
67 | 0 | } else { |
68 | 0 | DCMIMAGE_WARN("unexpected attribute 'PlanarConfiguration' (" << us |
69 | 0 | << ") ... ignoring"); |
70 | 0 | } |
71 | 0 | } |
72 | 0 | else if (samples > 1) |
73 | 0 | { |
74 | 0 | status = EIS_MissingAttribute; |
75 | 0 | DCMIMAGE_ERROR("mandatory attribute 'PlanarConfiguration' is missing"); |
76 | 0 | return; |
77 | 0 | } |
78 | 0 | if (pixel != NULL) |
79 | 0 | { |
80 | | // number of pixels (per plane) computed from the length of the PixelData attribute |
81 | 0 | InputCount = pixel->getPixelCount() / ((sample_rate == 0) ? samples : sample_rate); |
82 | | // number of pixels allocated for the intermediate buffer |
83 | 0 | Count = pixel->getComputedCount() / ((sample_rate == 0) ? samples : sample_rate); |
84 | 0 | } |
85 | 0 | } else { |
86 | 0 | status = EIS_MissingAttribute; |
87 | 0 | DCMIMAGE_ERROR("mandatory attribute 'SamplesPerPixel' is missing"); |
88 | 0 | } |
89 | 0 | } |
90 | 0 | } |
91 | | |
92 | | DiColorPixel::DiColorPixel(const DiColorPixel *pixel, |
93 | | const unsigned long count) |
94 | 0 | : DiPixel(count, pixel->InputCount), |
95 | 0 | PlanarConfiguration(pixel->PlanarConfiguration) |
96 | 0 | { |
97 | 0 | } |
98 | | |
99 | | |
100 | | /*--------------* |
101 | | * destructor * |
102 | | *--------------*/ |
103 | | |
104 | | DiColorPixel::~DiColorPixel() |
105 | 0 | { |
106 | 0 | } |