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: DicomYBRPart422Image (Source)
19  *
20  */
21 
22 
23 #include "dcmtk/config/osconfig.h"
24 
25 #include "dcmtk/dcmdata/dctypes.h"
26 
27 #include "dcmtk/dcmimage/diyp2img.h"
28 #include "dcmtk/dcmimage/diyp2pxt.h"
29 #include "dcmtk/dcmimage/dilogger.h"
30 #include "dcmtk/dcmimgle/diinpx.h"
31 
32 
33 /*----------------*
34  *  constructors  *
35  *----------------*/
36 
DiYBRPart422Image(const DiDocument * docu,const EI_Status status)37 DiYBRPart422Image::DiYBRPart422Image(const DiDocument *docu,
38                                      const EI_Status status)
39   : DiColorImage(docu, status, 2)
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 
~DiYBRPart422Image()52 DiYBRPart422Image::~DiYBRPart422Image()
53 {
54 }
55 
56 
57 /*********************************************************************/
58 
59 
Init()60 void DiYBRPart422Image::Init()
61 {
62     switch (InputData->getRepresentation())
63     {
64         case EPR_Uint8:
65             InterData = new DiYBRPart422PixelTemplate<Uint8, Uint8>(Document, InputData, ImageStatus, BitsPerSample);
66             break;
67         case EPR_Sint8:
68             InterData = new DiYBRPart422PixelTemplate<Sint8, Uint8>(Document, InputData, ImageStatus, BitsPerSample);
69             break;
70         case EPR_Uint16:
71             InterData = new DiYBRPart422PixelTemplate<Uint16, Uint16>(Document, InputData, ImageStatus, BitsPerSample);
72             break;
73         case EPR_Sint16:
74             InterData = new DiYBRPart422PixelTemplate<Sint16, Uint16>(Document, InputData, ImageStatus, BitsPerSample);
75             break;
76         case EPR_Uint32:
77             InterData = new DiYBRPart422PixelTemplate<Uint32, Uint32>(Document, InputData, ImageStatus, BitsPerSample);
78             break;
79         case EPR_Sint32:
80             InterData = new DiYBRPart422PixelTemplate<Sint32, Uint32>(Document, InputData, ImageStatus, BitsPerSample);
81             break;
82     }
83     deleteInputData();
84     checkInterData();
85 }
86 
87 
88 /*********************************************************************/
89 
90 
processNextFrames(const unsigned long fcount)91 int DiYBRPart422Image::processNextFrames(const unsigned long fcount)
92 {
93     if (DiImage::processNextFrames(fcount))
94     {
95         delete InterData;
96         InterData = NULL;
97         Init();
98         return (ImageStatus == EIS_Normal);
99     }
100     return 0;
101 }
102