DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Sun, 2017-04-23, 06:35

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue, 2008-02-26, 10:11 
Offline

Joined: Sun, 2008-02-24, 10:27
Posts: 3
I am new to DICOM, and as a first study task I converted a TIFF image to DICOM. I followed, more or less, DCMTK examples. The image file I created is read by IrfanView, for example, as a dcm file, but not by DICOMscope. I ger a 'load failed' error. The log file says 'Invalid data structures'. I geuss DICOMscope is more strict, but I cannot find what exatly do I miss. (The file is grayscale and not compressed).

The relevant code snippet is like this:

// Preparing DCM image data
status = dataset->putAndInsertUint16(DCM_Rows, h) ;
if (status.bad())
wcout << "error inserting DCM rows - " << status.text() << endl ;
status = dataset->putAndInsertUint16(DCM_Columns, w) ;
if (status.bad())
wcout << "error inserting DCM columns - " << status.text() << endl ;
dataset->putAndInsertUint16(DCM_SamplesPerPixel, myTiffReader.get_sample_num()) ;
status = dataset->putAndInsertString(DCM_PhotometricInterpretation,
PhotometricInterpretationNames[EPI_Monochrome1-1].Name) ;
if (status != EC_Normal)
wcout << "Error inserting DICOM photometric interpretation tag." << endl ;
dataset->putAndInsertUint16(DCM_BitsAllocated, 16) ;
dataset->putAndInsertUint16(DCM_BitsStored, 12) ;
status = dataset->putAndInsertUint16(DCM_HighBit, 15) ;
if (status.bad())
wcout << "error inserting DCM Highbit - " << status.text() << endl ;
dataset->putAndInsertUint16(DCM_PixelRepresentation, 0) ;
dataset->putAndInsertUint16(DCM_PlanarConfiguration, 0) ;
status = dataset->putAndInsertUint16Array(DCM_PixelData, DCM_Buff, w*h) ;
if (status == EC_Normal)
{
status = fileFormat.saveFile(argv[3], EXS_LittleEndianExplicit) ;
if (status.good())
wcout << "DICOM output file " << argv[3] << " was saved successfully" << endl ;
else
wcout << "Error writing DICOM output file " << argv[3] << endl ;
}
else
wcout << "Failed writing pixel data to DICOM data set" << endl ;

Can anyone give me a hint as where and how to look for the mistake?


Top
 Profile  
 
 Post subject:
PostPosted: Tue, 2008-02-26, 11:22 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
What does dcm2pnm output in verbose/debug mode?


Top
 Profile  
 
 Post subject:
PostPosted: Tue, 2008-02-26, 12:34 
Offline

Joined: Sun, 2008-02-24, 10:27
Posts: 3
In ran dcm2pnm with the options: -v -d +ot
The output doesn't look too helpful to me:

reading DICOM file: D:\DICOM\dcmdemo\dcmdemo\out.dcm
preparing pixel data.
disabling VOI window computation
writing frame 1 to d:\DICOM\dcmdemo\dcmdemo\out2.tif
TIFF: Error writing TIFF header.
cleaning up memory.

Any insight or suggestion?


Top
 Profile  
 
 Post subject:
PostPosted: Tue, 2008-02-26, 12:43 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
Would you mind sending the image "out.dcm" to us by email (dicom/at/offis/dot/de)?


Top
 Profile  
 
 Post subject:
PostPosted: Tue, 2008-02-26, 14:11 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
I've checked the file with our DCMCHECK validation tool and found a numerous errors:

Code:
**************************************************************************
**  check inconsistencies between the given data and the iod-definition **
**                  (Part 3 of the DICOM-Standard)                      **
**************************************************************************

Error E-04: Attribute is missing.
   Affected attribute: StudyDate(0008,0020) (modules GeneralStudyModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: StudyTime(0008,0030) (modules GeneralStudyModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: AccessionNumber(0008,0050) (modules GeneralStudyModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: Modality(0008,0060) (modules GeneralSeriesModule, SCEquipmentModule) (Type 1)

Error E-04: Attribute is missing.
   Affected attribute: ConversionType(0008,0064) (modules SCEquipmentModule) (Type 1)

Error E-04: Attribute is missing.
   Affected attribute: ReferringPhysiciansName(0008,0090) (modules GeneralStudyModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: PatientID(0010,0020) (modules PatientModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: PatientsBirthDate(0010,0030) (modules PatientModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: PatientsSex(0010,0040) (modules PatientModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: StudyInstanceUID(0020,000d) (modules GeneralStudyModule) (Type 1)

Error E-04: Attribute is missing.
   Affected attribute: SeriesInstanceUID(0020,000e) (modules GeneralSeriesModule) (Type 1)

Error E-04: Attribute is missing.
   Affected attribute: StudyID(0020,0010) (modules GeneralStudyModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: SeriesNumber(0020,0011) (modules GeneralSeriesModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: InstanceNumber(0020,0013) (modules GeneralImageModule, SOPCommonModule) (Type 2)

Error E-04: Attribute is missing.
   Affected attribute: PatientOrientation(0020,0020) (modules GeneralImageModule) (Type 2C)
   Condition "(not(/ImageOrientationPatient exists)) and (not(/ImagePositionPatient exists))" is true.

Error E-05: Attribute is unexpected.
   Affected attribute: PlanarConfiguration(0028,0006) (Type 1C) (vm=1; len=2; modules: ImagePixelModule)
   Condition "val(./SamplesPerPixel[0]) > 1" is false.


You should first fix these violations of the DICOM standard before trying to open the file with DICOMscope. Please note that DICOMscope uses a couple of more header attributes than the underlying DCMTK for processing the image (e.g. Series and Study Instance UID).


Top
 Profile  
 
 Post subject:
PostPosted: Wed, 2008-02-27, 08:32 
Offline

Joined: Sun, 2008-02-24, 10:27
Posts: 3
Thanks for the help. I will work in this direction, and I probably need to add dcmcheck to my tools.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group