I already read some topics on this forum but I don't have explicit answer for my problem.
The goal what I would like to achieve is saving data(images) in real time from "instrument/camera it doesn't matter" to DICOM file. Data are represented as byte array(RAW data).
Number of frames at the beginning experiment is unknown. So I need to do it dynamically. And very important thing is that amount of data is very large per one file(more than 30GB)
1) First of all, is it possible using DICOM and dcmtk library?
2) I'm notice, when I use sample code from this forum about saving uncompressed RAW data, the maximum file size is around 4GB. To summarize this point, when amount of data is less than 4GB file is saved correctly, and I can open this file in other DICOM viewer. Otherwise, file is corrupted. Below I put code which I use.
Code: Select all
DcmFileFormat fileformat;
DcmDataset *dataset = fileformat.getDataset();
char uid[100];
dataset->putAndInsertString(DCM_SOPClassUID, UID_BasicGrayscaleImageBoxSOPClass);
dataset->putAndInsertString(DCM_SOPInstanceUID, dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT));
dataset->putAndInsertString(DCM_PatientName, "SomeName");
dataset->putAndInsertString(DCM_PatientID, "1234 ");
dataset->putAndInsertString(DCM_PatientBirthDate, "19010101");
dataset->putAndInsertString(DCM_StudyDate, date.c_str());
dataset->putAndInsertString(DCM_StudyTime, time.c_str());
dataset->putAndInsertString(DCM_StudyDescription, "Tests");
dataset->putAndInsertString(DCM_NumberOfFrames, std::to_string(numberOfImages).c_str());
dataset->putAndInsertUint16(DCM_Rows, height);
dataset->putAndInsertUint16(DCM_Columns, width);
dataset->putAndInsertUint16(DCM_BitsAllocated, 8);
dataset->putAndInsertUint16(DCM_BitsStored, 8);
dataset->putAndInsertUint16(DCM_PhysicalUnitsXDirection, 0x000C);
dataset->putAndInsertUint16(DCM_PhysicalUnitsYDirection, 0x000C);
dataset->putAndInsertUint16(DCM_PixelRepresentation, 0 /* 0 - unsigned, 1 - signed*/);
dataset->putAndInsertString(DCM_PhotometricInterpretation, "MONOCHROME2");
auto pData = new BYTE[(long long)width*height*numberOfImages];
OFCondition status = dataset->putAndInsertUint8Array(DCM_PixelData, pData, width*height*numberOfImages, false);
status = fileformat.saveFile("e:\\test.dcm", EXS_LittleEndianExplicit);
4) Is there any performance test(benchmarks) to save dicom files to hard drive using dcmtk?
Thank you in advice!