[Insight-users] Writing new DICOM files.
Mathieu Malaterre
mathieu.malaterre at gmail.com
Wed Nov 12 09:33:29 EST 2008
Todd,
On Wed, Nov 12, 2008 at 2:01 PM, Todd Jensen <todd.jensen at ieee.org> wrote:
> Hello, Mathieu,
>
>> > Media Storage SOP Instance UID (0002,0003) is set to a newly generated UID
>> > Image Type is set to DERIVED\PRIMARY
>>
>> I think what you are looking for is: itk::GDCMImageIO::KeepOriginalUID( true )
>
> I am using this.
>
>> > And since the 0002,0003 element is set to a new unique UID, it never matches
>> the SOP Instance UID which is an error.
>>
>> what ? 0002,0003 should match the value from the dataset. If you found
>> an issue, please report, a simple way to reproduce it. Thank you.
>
> Here is how to reproduce, using ITK 3.6:
>
> 1) Set the SOP Instance UID in meta data:
>
> itk::MetaDataDictionary outMetaData;
>
> // Assign values to required DICOM elements for SC SOP class UID in meta data...
> //
> [...removed for brevity...] (I have verified the requirement elements are all set using the standard documentation and David Clunie's verification tools)
+1
> // Assign SOP Instance UID with a defined prefix...
> //
> vcl_string instanceUID = gdcm::Util::CreateUniqueUID( uidPrefix );
> itk::EncapsulateMetaData< vcl_string >( outMetaData, "0008|0018", instanceUID );
> itk::EncapsulateMetaData< vcl_string >( outMetaData, "0002|0003", instanceUID );
>
> 2) Attach meta data to GDCM:
>
> itk::GDCMImageIO::Pointer dicomIO = itk::GDCMImageIO::New();
> typedef itk::ImageFileWriter< ImageType2D > WriterType;
> WriterType::Pointer dcmWriter = WriterType::New();
>
> outputImage->SetMetaDataDictionary( outMetaData );
> dicomIO->SetKeepOriginalUID( true );
> dcmWriter->SetFileName( outputFile.str() );
> dcmWriter->SetInput( outputImage );
> dcmWriter->SetImageIO( dicomIO );
> dcmWriter->Update();
>
> gdcm::FileHelper::CheckMandatoryElements() will regenerate the media storage SOP instance UID even though KeepOriginalUID is set to true.
>
> I hope this helps explain the issue. Also, it would be nice if I could keep the image type I set (it is forced to DERIVED\\PRIMARY)
This is in fact the exact same issue, those info are linked to each
other. I'll try to duplicate here and let you know what I found out.
Thanks for your time and bug report,
--
Mathieu
More information about the Insight-users
mailing list