createNewDicomDir writes incomplete DICOMDIR file
Moderator: Moderator Team
-
- Posts: 26
- Joined: Fri, 2015-10-16, 09:18
createNewDicomDir writes incomplete DICOMDIR file
Hi,
I am using createNewDicomDir to create DICOMDIR. The file is created, but the content of it seems incomplete. Reading it results in errors. I am wondering what is the right way to use this function?
This is how I make the call:
OFCondition status = dicomdir.createNewDicomDir(DicomDirInterface::AP_DentalRadiograph, convertToStlString(dicomDirFileName).c_str(), DEFAULT_FILESETID);
Is it because of the filesetID setting?
Please advise, thanks a lot!!
Evan
I am using createNewDicomDir to create DICOMDIR. The file is created, but the content of it seems incomplete. Reading it results in errors. I am wondering what is the right way to use this function?
This is how I make the call:
OFCondition status = dicomdir.createNewDicomDir(DicomDirInterface::AP_DentalRadiograph, convertToStlString(dicomDirFileName).c_str(), DEFAULT_FILESETID);
Is it because of the filesetID setting?
Please advise, thanks a lot!!
Evan
-
- DCMTK Developer
- Posts: 2503
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: createNewDicomDir writes incomplete DICOMDIR file
Did you also add entries (i.e. Directory Records) to the DICOMDIR? This is done using DicomDirInterface::addDicomFile().
-
- Posts: 26
- Joined: Fri, 2015-10-16, 09:18
Re: createNewDicomDir writes incomplete DICOMDIR file
Yes. This is my implementation:
StlWString dicomDirFileName(m_dicomdirPathName + L"DICOMDIR");
// Create DICOMDIR:
DicomDirInterface dicomdir;
OFCondition status = dicomdir.createNewDicomDir(DicomDirInterface::/*AP_GeneralPurpose*/AP_DentalRadiograph,
convertToStlString(dicomDirFileName).c_str(),
DEFAULT_FILESETID);
if ( !status.good() )
return false;
StlWStringVector dcmFileNames = getAllDcmFileNames();
if ( dcmFileNames.empty() )
{
// No dcm file exists in the folder!
return false;
}
for ( StlWStringVector::iterator ft = dcmFileNames.begin(); ft != dcmFileNames.end(); ++ft )
{
dicomdir.addDicomFile(convertToStlString(*ft).c_str(),
convertToStlString(m_dicomdirPathName).c_str());
}
// Write DICOMDIR:
status = dicomdir.writeDicomDir();
if ( !status.good() )
return false;
return true;
Thanks,
Evan
StlWString dicomDirFileName(m_dicomdirPathName + L"DICOMDIR");
// Create DICOMDIR:
DicomDirInterface dicomdir;
OFCondition status = dicomdir.createNewDicomDir(DicomDirInterface::/*AP_GeneralPurpose*/AP_DentalRadiograph,
convertToStlString(dicomDirFileName).c_str(),
DEFAULT_FILESETID);
if ( !status.good() )
return false;
StlWStringVector dcmFileNames = getAllDcmFileNames();
if ( dcmFileNames.empty() )
{
// No dcm file exists in the folder!
return false;
}
for ( StlWStringVector::iterator ft = dcmFileNames.begin(); ft != dcmFileNames.end(); ++ft )
{
dicomdir.addDicomFile(convertToStlString(*ft).c_str(),
convertToStlString(m_dicomdirPathName).c_str());
}
// Write DICOMDIR:
status = dicomdir.writeDicomDir();
if ( !status.good() )
return false;
return true;
J. Riesmeier wrote:Did you also add entries (i.e. Directory Records) to the DICOMDIR? This is done using DicomDirInterface::addDicomFile().
Thanks,
Evan
-
- DCMTK Developer
- Posts: 2503
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: createNewDicomDir writes incomplete DICOMDIR file
What does addDicomFile() return?
-
- Posts: 26
- Joined: Fri, 2015-10-16, 09:18
Re: createNewDicomDir writes incomplete DICOMDIR file
It returns OF_error.
J. Riesmeier wrote:What does addDicomFile() return?
-
- DCMTK Developer
- Posts: 2503
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: createNewDicomDir writes incomplete DICOMDIR file
And what ist the exact error code, i.e. what does OFCondition::code() or OFCondition::text() return? What is the output to the logger?
-
- Posts: 26
- Joined: Fri, 2015-10-16, 09:18
Re: createNewDicomDir writes incomplete DICOMDIR file
It turned out that the problem is invalid character `.' in the file name.
I understand that file names like `0275.dcm' violate DICOM naming convention. However, I am not sure we can enforce this policy with all of our doctors.
Any suggestion?
Thanks,
Evan
I understand that file names like `0275.dcm' violate DICOM naming convention. However, I am not sure we can enforce this policy with all of our doctors.
Any suggestion?
Thanks,
Evan
J. Riesmeier wrote:And what ist the exact error code, i.e. what does OFCondition::code() or OFCondition::text() return? What is the output to the logger?
-
- DCMTK Developer
- Posts: 2503
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: createNewDicomDir writes incomplete DICOMDIR file
Right, the "." and the filename extension "dcm" are not allowed.I understand that file names like `0275.dcm' violate DICOM naming convention.
The filename conventions have nothing to do with the users (doctors). This is a technical question and the doctors will usually not see filenames but patient namesHowever, I am not sure we can enforce this policy with all of our doctors.
-
- Posts: 26
- Joined: Fri, 2015-10-16, 09:18
Re: createNewDicomDir writes incomplete DICOMDIR file
I renamed the files and now I am hitting new errors.
This time it is about invalid SOP.
I tried both DicomDirInterface::AP_GeneralPurpose and DicomDirInterface::AP_DentalRadiograph and got invalid SOP.
I also tried DicomDirInterface::AP_CTandMR, seems to pass the SOP test, but got into problems downstream.
How do you choose this option? I know this DICOM data is valid because I was able to generate valid DICOMDIR out of the same data using other software.
Please advise, thanks!
Evan
This time it is about invalid SOP.
I tried both DicomDirInterface::AP_GeneralPurpose and DicomDirInterface::AP_DentalRadiograph and got invalid SOP.
I also tried DicomDirInterface::AP_CTandMR, seems to pass the SOP test, but got into problems downstream.
How do you choose this option? I know this DICOM data is valid because I was able to generate valid DICOMDIR out of the same data using other software.
Please advise, thanks!
Evan
J. Riesmeier wrote:Right, the "." and the filename extension "dcm" are not allowed.I understand that file names like `0275.dcm' violate DICOM naming convention.
The filename conventions have nothing to do with the users (doctors). This is a technical question and the doctors will usually not see filenames but patient namesHowever, I am not sure we can enforce this policy with all of our doctors.
-
- DCMTK Developer
- Posts: 2503
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: createNewDicomDir writes incomplete DICOMDIR file
Of course, you shouldn't try out which Storage Media Application Profile fits your files but check before in the DICOM standard (part 11).I tried both DicomDirInterface::AP_GeneralPurpose and DicomDirInterface::AP_DentalRadiograph and got invalid SOP.
I also tried DicomDirInterface::AP_CTandMR, seems to pass the SOP test, but got into problems downstream.
Each Application Profile has been defined for a particular purpose, e.g. to exchange cath lab films in cardiology on CD (STD-XABC-CD).
-
- Posts: 26
- Joined: Fri, 2015-10-16, 09:18
Re: createNewDicomDir writes incomplete DICOMDIR file
Thank you.
I've identified the correct application profile for my application, it's AP_CTandMR. However I am still having problems: DCM_StudyID seems to be non-existent in the scan data. In the code comment it says:
/* StudyID is type 1 in DICOMDIR and type 2 in images */
Could you please advise on what should be a correct DCM_StudyID? Thanks!
Regards,
Evan
I've identified the correct application profile for my application, it's AP_CTandMR. However I am still having problems: DCM_StudyID seems to be non-existent in the scan data. In the code comment it says:
/* StudyID is type 1 in DICOMDIR and type 2 in images */
Could you please advise on what should be a correct DCM_StudyID? Thanks!
Regards,
Evan
J. Riesmeier wrote:Of course, you shouldn't try out which Storage Media Application Profile fits your files but check before in the DICOM standard (part 11).I tried both DicomDirInterface::AP_GeneralPurpose and DicomDirInterface::AP_DentalRadiograph and got invalid SOP.
I also tried DicomDirInterface::AP_CTandMR, seems to pass the SOP test, but got into problems downstream.
Each Application Profile has been defined for a particular purpose, e.g. to exchange cath lab films in cardiology on CD (STD-XABC-CD).
-
- DCMTK Developer
- Posts: 2503
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: createNewDicomDir writes incomplete DICOMDIR file
This is why we have the "invent mode": http://support.dcmtk.org/docs-snapshot/ ... 419f4848d0
Who is online
Users browsing this forum: No registered users and 1 guest