How to encapsulate a series of DICOM files?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
qimo601
Posts: 32
Joined: Wed, 2012-06-06, 07:38

How to encapsulate a series of DICOM files?

#1 Post by qimo601 »

Hi,Everyone.
I'm using DcmDataset class to encapsulate a series of dicom files.
I can read the single dicom, But can't open these dicoms for 3D reconstruction with 3D slicer software after writing raw data to these dicom files as a series .

Is there some error in my method?
or is there a example code in encapsulating a study or a series ?

Thanks all.


1.a signle dicom encapsulated by my program.
Image

2.My writing code:

Code: Select all

OFCondition status;	
	//create DICOM file
	m_DcmFileFormat = new DcmFileFormat();
	m_DcmDataset = m_DcmFileFormat->getDataset();
	
	//encapsulate SOP Common Module
	m_DcmDataset->putAndInsertString(DCM_SOPClassUID,UID_CTImageStorage);
	
	char uid[100];
	m_DcmDataset->putAndInsertString(DCM_SOPInstanceUID,dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT));
	m_DcmDataset->putAndInsertString(DCM_SpecificCharacterSet,"ISO_IR 100");
	DcmDate *instanceCreationDate = new DcmDate(DCM_InstanceCreationDate); 
	status = instanceCreationDate->setCurrentDate();
	if (!status.good())
	{
		qDebug()<<"Create InstanceCreationDate error!";
	}
	m_DcmDataset->insert(instanceCreationDate);
	instanceCreationDate = NULL;

	

	//pixel data
	DcmPixelData *pixelData = new DcmPixelData(DCM_PixelData);
        status = pixelData->putUint16Array(vo_PixelData,m_DicomSize);



    if (!status.good())
    {
        qDebug()<<"pixelData->putUint16Array error!";
    }
    //pixelData->putFloat32Array(vo_PixelData,m_DicomSize);

    status = m_DcmDataset->insert(pixelData);
    if (!status.good())
    {
        qDebug()<<"m_DcmDataset->insert(pixelData) error!";
    }

	qDebug()<<"add:"<<QString::number(vo_InstanceNumber);

3. I can't open these dicoms with 3D slicer.
Image
Last edited by qimo601 on Tue, 2017-07-25, 07:25, edited 1 time in total.

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

Re: How to encapsulate a series of DICOM files?

#2 Post by Michael Onken »

Scanning over your code it seems you are generally doing the right thing; I did not check each value though.

Whenever *I* create DICOM objects, I check them with a DICOM checker tool first. I can recommend dciodvfy from David Clunie for this task. It finds out whether you are setting all values required for a CT Image IOD, whether values are correct regarding their DICOM datatype and so on. dciodvfy is part of the dicom3tools with Windows binaries available here.

Best regards,
Michael

qimo601
Posts: 32
Joined: Wed, 2012-06-06, 07:38

Re: How to encapsulate a series of DICOM files?

#3 Post by qimo601 »

Michael Onken wrote:Scanning over your code it seems you are generally doing the right thing; I did not check each value though.

Whenever *I* create DICOM objects, I check them with a DICOM checker tool first. I can recommend dciodvfy from David Clunie for this task. It finds out whether you are setting all values required for a CT Image IOD, whether values are correct regarding their DICOM datatype and so on. dciodvfy is part of the dicom3tools with Windows binaries available here.

Best regards,
Michael
Thank you,Michael.

I will try it.

Post Reply

Who is online

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