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