[Insight-users] Strange error when reading DICOM

Patrik Brynolfsson patrik.brynolfsson at gmail.com
Tue Jun 16 07:25:53 EDT 2009


Hello again,
By reassigning the reader smartpointer inside the loop:

ReaderType::Pointer reader = ReaderType::New();

before setting the filenames to read
reader->SetFileNames( fileNames );

i get it to work. I don't like the fix though, and I would like to
understand why it doesn't work and a more elegant way to fix it, if
possible. Does anyone know the solution to this?

2009/6/16 Patrik Brynolfsson <patrik.brynolfsson at gmail.com>

> Hello Mathieu, Thanks for the quick reply!
>
> So different DICOM series have different sizes and orientations, is that
> why it doesn't work? All images within one series have the same orientation
> and size, and any one series can be read without problem. If I read multiple
> series in a loop I sometimes run into trouble. Is there a way to "reset" the
> reader before each new series to avoid the error?
>
>
>
> 2009/6/16 Mathieu Malaterre <mathieu.malaterre at gmail.com>
>
> On Tue, Jun 16, 2009 at 11:43 AM,
>> Patrik.Br.<patrik.brynolfsson at gmail.com> wrote:
>> >
>> > Hello,
>> >
>> > I am trying to read DICOM series from a folder, much like in example
>> > DicomSeriesReadImageWrite2.cxx. However, I modified the reader so that
>> it
>> > loops over all found series instead of just the first:
>> >
>> > SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
>> > SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
>> > std::string seriesIdentifier;
>> > typedef std::vector< std::string >   FileNamesContainer;
>> > FileNamesContainer fileNames;
>> >
>> > while( seriesItr != seriesEnd )
>> >   {
>> >    seriesIdentifier = seriesItr->c_str();
>> >    fileNames = nameGenerator->GetFileNames( seriesIdentifier );
>> >    reader->SetFileNames( fileNames );
>> >        try{
>> >            reader->Update();
>> >            }
>> >        catch (itk::ExceptionObject &ex)
>> >            {
>> >            std::cout << ex << std::endl;
>> >            return EXIT_FAILURE;
>> >            }
>> >
>> >       {
>> >        //Some code
>> >       }
>> >
>> >    seriesItr++;
>> >   }
>> >
>> > However I sometimes get the error
>> > "Requested region is (at least partially) outside the largest possible
>> > region."
>> > I first thought this was due to one faulty DICOM series, but it happens
>> for
>> > many series, but not all of them. It only happens when I read multiple
>> DICOM
>> > series i.e. when I use the loop, never when I read just one series.
>> Also,
>> > depending on what other series have been read before, some series might
>> or
>> > might not be read correctly without error. What's going on?
>>
>> This means you have DICOM files with:
>> 1. Either different Image Orientation (Patient), (=itk orientation)
>> 2. different dimensions (Columns / Rows).
>>
>> You can check that image are compatible with simple command line tool
>> such as gdcminfo from GDCM 2.x package.
>>
>> Ref:
>> http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=Gdcminfo
>>
>> Download:
>>
>> http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=GDCM_Release_2.0#GDCM_2.0.12_.282008.2F06.2F12.29
>>
>> 2cts
>> --
>> Mathieu
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090616/dfd673de/attachment.htm>


More information about the Insight-users mailing list