hello...
iam looking for a method to save dicom images....
iam having all the image attributes in hand and i need to fill in the attributes of the dicom image and save the dicom image.....
i tried to create a DcmDataset and add all the attributes.....and then i passed the pointer to Dataset as parameter to DCM FileFormat constructor......
from the DCMFileFormat object pointer i tried to call the SaveFile Method..
but iam not able to get the resultant file....
some file is written with out any data on it(0 bytes)...
could some one help me on this.....
some other method to do this will be even more helpful.....
Thanks in advance,
ashok
DICOM Image saving
Moderator: Moderator Team
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
The following example shows how to create a DICOM dataset and save it to a file:
Btw, this example is part of the toolkit's HTML documentation.
Code: Select all
char uid[100];
DcmFileFormat fileformat;
DcmDataset *dataset = fileformat.getDataset();
dataset->putAndInsertString(DCM_SOPClassUID, UID_SecondaryCaptureImageStorage);
dataset->putAndInsertString(DCM_SOPInstanceUID, dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT));
dataset->putAndInsertString(DCM_PatientsName, "Doe^John");
/* ... */
dataset->putAndInsertUint8Array(DCM_PixelData, pixelData, pixelLength);
OFCondition status = fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
if (status.bad())
cerr << "Error: cannot write DICOM file (" << status.text() << ")" << endl;
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 1 guest