/src/dcmtk/dcmimgle/libsrc/dimoopx.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: dcmimgle |
15 | | * |
16 | | * Author: Joerg Riesmeier |
17 | | * |
18 | | * Purpose: DicomMonoOutputPixel (Source) |
19 | | * |
20 | | */ |
21 | | |
22 | | |
23 | | #include "dcmtk/config/osconfig.h" |
24 | | |
25 | | #include "dcmtk/dcmimgle/dimoopx.h" |
26 | | #include "dcmtk/dcmimgle/dimopx.h" |
27 | | |
28 | | |
29 | | /*----------------* |
30 | | * constructors * |
31 | | *----------------*/ |
32 | | |
33 | | DiMonoOutputPixel::DiMonoOutputPixel(const DiMonoPixel *pixel, |
34 | | const unsigned long size, |
35 | | const unsigned long frame, |
36 | | const unsigned long max) |
37 | 0 | : Count(0), |
38 | 0 | FrameSize(size), |
39 | 0 | UsedValues(NULL), |
40 | 0 | MaxValue(max) |
41 | 0 | { |
42 | 0 | if (pixel != NULL) |
43 | 0 | { |
44 | 0 | if (pixel->getCount() > frame * size) |
45 | 0 | Count = pixel->getCount() - frame * size; // number of pixels remaining for this 'frame' |
46 | 0 | } |
47 | 0 | if (Count > FrameSize) |
48 | 0 | Count = FrameSize; // cut off at frame 'size' |
49 | 0 | } |
50 | | |
51 | | |
52 | | /*--------------* |
53 | | * destructor * |
54 | | *--------------*/ |
55 | | |
56 | | DiMonoOutputPixel::~DiMonoOutputPixel() |
57 | 0 | { |
58 | 0 | delete[] UsedValues; |
59 | 0 | } |
60 | | |
61 | | |
62 | | /**********************************/ |
63 | | |
64 | | |
65 | | int DiMonoOutputPixel::isUnused(const unsigned long value) |
66 | 0 | { |
67 | 0 | if (UsedValues == NULL) |
68 | 0 | determineUsedValues(); // create on demand |
69 | 0 | if (UsedValues != NULL) |
70 | 0 | { |
71 | 0 | if (value <= MaxValue) |
72 | 0 | return OFstatic_cast(int, UsedValues[value] == 0); |
73 | 0 | return 2; // out of range |
74 | 0 | } |
75 | 0 | return 0; |
76 | 0 | } |