-
- // TODO : get the grPixel, numPixel values
- guint16 grPixel =0x7fe0;
- guint16 numPixel=0x0010;
-
- IterHT p;
- TagKey key = gdcmDictEntry::TranslateToKey(grPixel, numPixel);
- gdcmHeaderEntry * a;
- TagHeaderEntryHT::iterator p2;
-
- //IterHT it = GetHeaderEntrySameNumber(grPixel,numPixel);
- // Update Pixel Data Length
- // the *last* of the 7fe0,0010, if many.
-
-/*
- // good looking, but it doesn't work
- p= Header->GetEntry().equal_range(key); // get a pair of iterators first-last synonym
- p2=p.second; // iterator on the last synonym
- a=p2->second; // H Table target column (2-nd col)
- //a->SetLength(lgrTotale);
- a->SetPrintLevel(2);
- a->Print();
- // use the old -wrong if many 7fe0,0010- way
- */
- if (PixelRead==1)
- Header->SetEntryLengthByNumber(lgrTotaleRaw,grPixel, numPixel);
- else if (PixelRead==0)
- Header->SetEntryLengthByNumber(lgrTotale, grPixel, numPixel);
- // if == -1 : no Pixel Data was read : abort the method
-
+
+ uint16_t grPixel = Header->GetGrPixel();
+ uint16_t numPixel = Header->GetNumPixel();;
+
+ gdcmDocEntry* PixelElement =
+ GetHeader()->GetDocEntryByNumber(grPixel, numPixel);
+
+ if ( PixelRead == 1 )
+ {
+ // we read pixel 'as is' (no tranformation LUT -> RGB)
+ PixelElement->SetLength( ImageDataSizeRaw );
+ }
+ else if ( PixelRead == 0 )
+ {
+ // we tranformed GrayLevel pixels + LUT into RGB Pixel
+ PixelElement->SetLength( ImageDataSize );
+ }
+