How to modify the data sequence of the dataset

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
liuxinming
Posts: 83
Joined: Thu, 2009-03-19, 04:19

How to modify the data sequence of the dataset

#1 Post by liuxinming »

The first part of my codes:

Code: Select all

DcmFileFormat fileformat;
OFCondition cond=fileformat.loadFile(sFileName.GetBuffer(0),EXS_JPEGProcess1);
DcmPixelData *pPixData;
cond=pDataset->findAndGetElement(DCM_PixelData,(DcmElement *&)pPixData);
Now I can manage the pixel data.

The second part:

Code: Select all

DcmPixelSequence *pSeq = NULL;
E_TransferSyntax xferSyntax = EXS_Unknown;
const DcmRepresentationParameter *rep = NULL;
cond=pPixData->getEncapsulatedRepresentation(xferSyntax, rep, pSeq);
by which I can operate the pixel sequence.

The third part:

Code: Select all

 DcmPixelItem *pItem;
cond=pSeq->getItem(pItem,j);
DcmPixelItem *pItemBk=(DcmPixelItem *)pItem->clone();
DcmPixelSequence *pNewSeq=new DcmPixelSequence(DCM_PixelData);
cond=pNewSeq->insert(pItemBk);
cond=pDataset->insert(pNewSeq,TRUE,TRUE);
But I don't believe that it will work well, though the cond is still "Normal".

These are all testing codes. What I hope to do are deleting some special frames in a large multiframe file and saving the rest into another file which has the same VR.

Post Reply

Who is online

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