/src/dcmtk/dcmimgle/libsrc/diovlimg.cc
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * Copyright (C) 1996-2016, 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: DicomOverlayImage (Source) |
19 | | * |
20 | | */ |
21 | | |
22 | | |
23 | | #include "dcmtk/config/osconfig.h" |
24 | | #include "dcmtk/dcmdata/dctypes.h" |
25 | | |
26 | | #include "dcmtk/dcmimgle/diovlimg.h" |
27 | | #include "dcmtk/dcmimgle/dimopxt.h" |
28 | | #include "dcmtk/dcmimgle/didocu.h" |
29 | | |
30 | | |
31 | | /*----------------* |
32 | | * constructors * |
33 | | *----------------*/ |
34 | | |
35 | | DiOverlayImage::DiOverlayImage(const DiDocument *docu, |
36 | | const EI_Status status) |
37 | 0 | : DiMono2Image(docu, status, 0) |
38 | 0 | { |
39 | 0 | if (Document != NULL) |
40 | 0 | { |
41 | 0 | Overlays[0] = new DiOverlay(Document); |
42 | 0 | if (Overlays[0] != NULL) |
43 | 0 | { |
44 | 0 | BitsPerSample = 1; |
45 | 0 | unsigned int i; |
46 | 0 | DiOverlayPlane *plane; |
47 | 0 | for (i = 0; i < Overlays[0]->getCount(); ++i) |
48 | 0 | { |
49 | 0 | plane = Overlays[0]->getPlane(i); |
50 | 0 | if (plane != NULL) |
51 | 0 | { |
52 | 0 | plane->show(); |
53 | 0 | if (plane->getNumberOfFrames() > NumberOfFrames) |
54 | 0 | NumberOfFrames = plane->getNumberOfFrames(); |
55 | 0 | if (plane->getRight() > Columns) // determine image's width and height |
56 | 0 | Columns = plane->getRight(); |
57 | 0 | if (plane->getBottom() > Rows) |
58 | 0 | Rows = plane->getBottom(); |
59 | 0 | } |
60 | 0 | } |
61 | 0 | if ((Rows > 0) && (Columns > 0)) |
62 | 0 | { |
63 | 0 | InterData = new DiMonoPixelTemplate<Uint8>(OFstatic_cast(unsigned long, Rows) * |
64 | 0 | OFstatic_cast(unsigned long, Columns) * NumberOfFrames); |
65 | 0 | if (InterData == NULL) |
66 | 0 | { |
67 | 0 | ImageStatus = EIS_MemoryFailure; |
68 | 0 | DCMIMGLE_ERROR("can't allocate memory for inter-representation"); |
69 | 0 | } |
70 | 0 | else if (InterData->getData() == NULL) |
71 | 0 | ImageStatus = EIS_InvalidImage; |
72 | 0 | } |
73 | 0 | else |
74 | 0 | { |
75 | 0 | ImageStatus = EIS_InvalidValue; |
76 | 0 | DCMIMGLE_ERROR("invalid value for 'Rows' (" << Rows << ") and/or 'Columns' (" << Columns << ")"); |
77 | 0 | } |
78 | 0 | } |
79 | 0 | } |
80 | 0 | else |
81 | 0 | { |
82 | 0 | ImageStatus = EIS_InvalidDocument; |
83 | 0 | DCMIMGLE_ERROR("this DICOM document is invalid"); |
84 | 0 | } |
85 | 0 | } |
86 | | |
87 | | |
88 | | /*--------------* |
89 | | * destructor * |
90 | | *--------------*/ |
91 | | |
92 | | DiOverlayImage::~DiOverlayImage() |
93 | 0 | { |
94 | 0 | } |