Ok, here's how I'm getting the data buffer (in a c++ shared library):
Code: Select all
const DiPixel * interdata = imgHandler->getDicomImage()->getInterData();
EP_Representation rep = interdata->getRepresentation();
switch(rep)
{
...
case EPR_Uint8:
{
bufSize = interdata->getCount();
buffer = new Uint8[bufSize];
break;
}
...
}
// buffer is a reference to a void * variable
memcpy((void *)buffer, interdata->getData(), bufSize);
Code: Select all
lTmpBuf := lBuf;
for llY := 0 to ImgHeight - 1 do
begin
lScanLine := FCanvasImage.ScanLine[llY];
for llX := 0 to ImgWidth - 1 do
begin
lRed := lTmpBuf[0];
lGreen := lTmpBuf[1];
lBlue := lTmpBuf[2];
lScanLine^ := lRed or (lGreen shl 8) or (lBlue shl 16) or (alphaOpaque shl 24);
inc(lTmpBuf);
inc(lScanLine);
end;
end;
My Result:
As you can see there are two differences:
1) Colors are wrongly displayed.
2) The image displayed by my program is displaced (the +/-100 pixels of the right must be shown at the left side).
Can you help me figure out why my program is displaying it wrong?.
Thanks in advance.