[Insight-users] How to read a dicom series and write it as a new series??
Mathieu Malaterre
mathieu.malaterre at gmail.com
Mon Jun 9 10:39:08 EDT 2008
Hi Sachin,
On Sun, Jun 8, 2008 at 9:19 AM, Sachin Jambawalikar <sachinjam at gmail.com> wrote:
> Hi all,
>
> I wanted to know how to read a dicom series and write it as a new
> series with a different series number and series UID.
> I tried using Bill lorensen's code posted in the mailing list
> http://www.itk.org/pipermail/insight-users/2008-May/025965.html
> It generates dicom files adds a new sereis however when I view
> through Pacs or a dicom viewer they skip some of the slices(for
> example if there are 160 dicom files in the series only 153 are
> loaded)
I do not understand what is going on here. You should print the output
of whatever filter you are using and make sure the size is correct:
filter->Update()
filter->GetOutput()->Print( std::cout );
If the dimension along which you are running your SeriesWriter is 153,
then you found your problem :)
> If I comment the line gdcmIO->KeepOriginalUIDOn() in the code then
> dicom viewer loads the generated file correctly (nothing skipped) but
> pacs thinks of it as a new study and doesnot include this new series
> with the original study.
>
> I've used the exact code of Bill Lorensen from the link but with
> resample parameters 0.0 0.0 0.0
Ok, so you are trying to create another Series, while trying to
preserve it's Study information, correct ?
this is not a scenario I have thought of before, so it will require
some hand coding.
You will need to keep:
gdcmIO->KeepOriginalUIDOn()
And then get the reader meta data dict array:
dicts = reader->GetMetaDataDictionaryArray()
for each array there will a value for key "0020|000e" (Series
Instance UID) that should be identical in all the individual dict. You
need to set it to something else (it needs to be identical for each
dict).:
Create ONE new uid to declare a new Study:
std::string myseriesuid = gdcm::Util::CreateUniqueUID( myUIDPrefix );
then iterate over all dicts and change manually the Series Instance UID:
for each dict in dicts:
itk::MetaDataDictionary & dict = dicts[i]
itk::EncapsulateMetaData<std::string>( dict, "0020|000e", myseriesuid );
HTH
--
Mathieu
More information about the Insight-users
mailing list