The first part of my codes:
Code:
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:
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:
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.