Reg. Uploading huge video files to DICOM/PACS server

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
narendra.v02
Posts: 3
Joined: Wed, 2016-10-12, 10:02

Reg. Uploading huge video files to DICOM/PACS server

#1 Post by narendra.v02 »

Hello,
I'm using the dcmtk lib for uploading images/ videos from an iPad app and I recently found that my application crashes while using the lib to write large buffer into DcmPixelSequence(from another file, size greater than 500MB).

I'm using the following code currently to upload files:

NSData *videodata = [NSData dataWithContentsOfFile:path];
unsigned char *bytePtr = (unsigned char *)[videodata bytes];
int32_t newsize = (int32_t) [videodata length];

DcmPixelSequence *sq;
sq = new DcmPixelSequence(DcmTag(DCM_PixelData, EVR_OB));
DcmPixelItem *dcmitem = new DcmPixelItem(DcmTag(DCM_Item, EVR_OB));
sq->insert(dcmitem);

sq->storeCompressedFrame(offsetList, bytePtr, newsize, 0);
DcmPixelData *pixelData = new DcmPixelData(DCM_PixelData);
pixelData->putOriginalRepresentation(EXS_MPEG2MainProfileAtMainLevel, NULL, sq);

dataset.insert(pixelData);
fileformat = DcmFileFormat::DcmFileFormat(&dataset);
OFCondition status = fileformat.saveFile([dcmPath UTF8String], EXS_MPEG2MainProfileAtMainLevel);

Currently I'm seeing a crash while calling storeCompressedFrame because (obviously!) the file couldnt be loaded into memory? Are you aware of any mechanism by which we can use a stream to resolve this issue? Any help would be highly appreciated.

Thanks,
Narendra

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Reg. Uploading huge video files to DICOM/PACS server

#2 Post by Michael Onken »

This problem has been solved via eMail.For the record:

The solution taken was to prepare the Pixel Data structure in a file first and then assign the value to the Pixel Data element in memory by calling createValueFromTempFile().

Later on, when reading the video to extract the video, DcmElement's getPartialValue() method has been used.

Michael

Sebastian Roehl
Posts: 1
Joined: Tue, 2016-11-15, 16:11

Re: Reg. Uploading huge video files to DICOM/PACS server

#3 Post by Sebastian Roehl »

I had a similar problem. The following code works for me:

Code: Select all

        
        DcmDataset* req = new DcmDataset();
        DcmPixelData* pixelData = new DcmPixelData(DCM_PixelData);
        DcmPixelSequence* pixelSequence = new DcmPixelSequence(DcmTag(DCM_PixelData, EVR_OB));//new DcmPixelSequence(DCM_PixelSequenceTag);
        DcmPixelItem* item = new DcmPixelItem(DcmTag(DCM_Item, EVR_OB));
        DcmPixelItem *offsetTable = new DcmPixelItem(DcmTag(DCM_Item, EVR_OB));
        DcmOffsetList offsetlist;

        size_t fileLen = OFStandard::getFileSize(filepath.c_str());

        item->createValueFromTempFile(fileStream.newFactory(), (const Uint32) fileLen, EBO_LittleEndian );
      
        pixelSequence->insert(offsetTable);
        pixelSequence->insert(item);

        offsetlist.push_back(0);

        offsetTable->createOffsetTable(offsetlist);

        pixelData->putOriginalRepresentation(transferSyntaxFile.getXfer(), NULL, pixelSequence);

        req->insert(pixelData,true,OFFalse);

Post Reply

Who is online

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