/src/dcmtk/dcmimage/libsrc/dicmyimg.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: DicomCMYKImage (Source) |
19 | | * |
20 | | */ |
21 | | |
22 | | |
23 | | #include "dcmtk/config/osconfig.h" |
24 | | |
25 | | #include "dcmtk/dcmdata/dctypes.h" |
26 | | |
27 | | #include "dcmtk/dcmimage/dicmyimg.h" |
28 | | #include "dcmtk/dcmimage/dicmypxt.h" |
29 | | #include "dcmtk/dcmimage/dilogger.h" |
30 | | #include "dcmtk/dcmimgle/diinpx.h" |
31 | | |
32 | | |
33 | | /*----------------* |
34 | | * constructors * |
35 | | *----------------*/ |
36 | | |
37 | | DiCMYKImage::DiCMYKImage(const DiDocument *docu, |
38 | | const EI_Status status) |
39 | 0 | : DiColorImage(docu, status, 4) |
40 | 0 | { |
41 | 0 | if ((Document != NULL) && (InputData != NULL) && (ImageStatus == EIS_Normal)) |
42 | 0 | { |
43 | 0 | Init(); // create intermediate representation |
44 | 0 | } |
45 | 0 | } |
46 | | |
47 | | |
48 | | /*--------------* |
49 | | * destructor * |
50 | | *--------------*/ |
51 | | |
52 | | DiCMYKImage::~DiCMYKImage() |
53 | 0 | { |
54 | 0 | } |
55 | | |
56 | | |
57 | | /*********************************************************************/ |
58 | | |
59 | | |
60 | | void DiCMYKImage::Init() |
61 | 0 | { |
62 | | /* number of pixels per plane */ |
63 | 0 | const unsigned long planeSize = OFstatic_cast(unsigned long, Columns) * OFstatic_cast(unsigned long, Rows); |
64 | 0 | switch (InputData->getRepresentation()) |
65 | 0 | { |
66 | 0 | case EPR_Uint8: |
67 | 0 | InterData = new DiCMYKPixelTemplate<Uint8, Uint8>(Document, InputData, ImageStatus, planeSize, BitsPerSample); |
68 | 0 | break; |
69 | 0 | case EPR_Sint8: |
70 | 0 | InterData = new DiCMYKPixelTemplate<Sint8, Uint8>(Document, InputData, ImageStatus, planeSize, BitsPerSample); |
71 | 0 | break; |
72 | 0 | case EPR_Uint16: |
73 | 0 | InterData = new DiCMYKPixelTemplate<Uint16, Uint16>(Document, InputData, ImageStatus, planeSize, BitsPerSample); |
74 | 0 | break; |
75 | 0 | case EPR_Sint16: |
76 | 0 | InterData = new DiCMYKPixelTemplate<Sint16, Uint16>(Document, InputData, ImageStatus, planeSize, BitsPerSample); |
77 | 0 | break; |
78 | 0 | case EPR_Uint32: |
79 | 0 | InterData = new DiCMYKPixelTemplate<Uint32, Uint32>(Document, InputData, ImageStatus, planeSize, BitsPerSample); |
80 | 0 | break; |
81 | 0 | case EPR_Sint32: |
82 | 0 | InterData = new DiCMYKPixelTemplate<Sint32, Uint32>(Document, InputData, ImageStatus, planeSize, BitsPerSample); |
83 | 0 | break; |
84 | 0 | } |
85 | 0 | deleteInputData(); |
86 | 0 | checkInterData(); |
87 | 0 | } |
88 | | |
89 | | |
90 | | /*********************************************************************/ |
91 | | |
92 | | |
93 | | int DiCMYKImage::processNextFrames(const unsigned long fcount) |
94 | 0 | { |
95 | 0 | if (DiImage::processNextFrames(fcount)) |
96 | 0 | { |
97 | 0 | delete InterData; |
98 | 0 | InterData = NULL; |
99 | 0 | Init(); |
100 | 0 | return (ImageStatus == EIS_Normal); |
101 | 0 | } |
102 | 0 | return 0; |
103 | 0 | } |