Rotated overlay question

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
dragon_fly
Posts: 16
Joined: Mon, 2012-11-05, 10:52

Rotated overlay question

#1 Post by dragon_fly » Mon, 2012-11-26, 07:18

Is there anyway to write rotated overlay data to the rotated dcm image?
I tried several ways, but failed.

1.

Code: Select all

DicomImage *pTempImg=new DicomImage(dcmDataset,xfer,CIF_AcrNemaCompatibility ,0,0);
pTempImg->rotateImage(90);
pTempImg->writeImageToDataset(*dcmDataset);
OFCondition a=dcmDataset->saveFile("rotatedImg.dcm",xfer);
pTempImg->writeBMP("rotatedImg.bmp",8,0);
Suppose there is an overlay data "L" on the left of the image,In rotatedImag.dcm,"L" is still on the left.
but in rotatedImg.bmp,"L" is rotated 90 degree and on the buttom.
2. Seems I should write the dcmDataset.

Code: Select all

DicomImage *pTempImg=new DicomImage(dcmDataset,xfer,CIF_AcrNemaCompatibility ,0,0);
UINT16 overlayRows;
UINT16 overlayColumns;
dcmDataset->findAndGetUint16(DCM_OverlayRows,overlayRows);
dcmDataset->findAndGetUint16(DCM_OverlayColumns,overlayColumns);
pTempImg->rotateImage(90);
 Uint8 *data=(Uint8*)pTempImg->getOverlayData(N,left_pos,top_pos,width,height,mode);
pTempImg->writeImageToDataset(*dcmDataset);
dcmDataset->putAndInsertUint8Array(DCM_OverlayData,data,width*height);
dcmDataset->putAndInsertUint16(DCM_OverlayRows,overlayColumns);
dcmDataset->putAndInsertUint16(DCM_OverlayColumns,overlayRows);
OFCondition a=dcmDataset->saveFile("rotatedImg.dcm",xfer);

In the rotatedImg.dcm,no overlay data "L".
3.Does it have something with DCM_OverlayOrigin?
And how to get DCM_OverlayOrigin?

Code: Select all

const Sint16 *overlayOrigin=new Sint16[2];
dcmDataset->findAndGetSint16Array(DCM_OverlayOrigin,overlayOrigin);
Is it right?
----------> it is right.

Problems solved!

dragon_fly
Posts: 16
Joined: Mon, 2012-11-05, 10:52

Re: Rotated overlay question

#2 Post by dragon_fly » Fri, 2012-11-30, 10:31

Problems solved!
:mrgreen:

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest