[Insight-users] reading writing multiple dicom files

Ashish Singh mrasingh at gmail.com
Tue Jan 16 13:23:50 EST 2007


Thanks for replying Luis. I found out what was causing the problem in my
code. Btw, I had posted my code before in the list. The link is:
http://public.kitware.com/pipermail/insight-users/2007-January/020588.html
I am trying to read 2D dicom files from a particular directory. These dicom
files may not belong to the same study/series. Then I do some processing on
the individual files and write them to a directory provided through a Qt
GUI.
I have most of this figure out, only a couple of things and I would
appreciate if you could help me with that-
1). How do I get rid of the new instance of pointer to reader and writer
that gets created inside the for loop. Using 'Delete()' gives me errors.
2). How do I set the outputdirectory name for the writer. There is a
'setoutputdirectory ' function for writing the series, but there isn't one
for the regular writer. I am supplying the writer with the file names and
want them all to go to a specific directory provided by the user from the
GUI. How do I do it?

Thanks,
Ashish

On 1/15/07, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
>
> Hi Ashish,
>
> You can reuse a reader for reading multiple
> series from a directory.
>
> It is however a common mistake to not initilize
> the reader properly when it is set inside a for
> loop.
>
> Please post your code to the list so we can give
> you more specific advice.
>
> Also, please describe your goal more precisely.
> In particular: are those 2D DICOM files or are
> they multi-frame DICOM files ?
>
> Are you trying to read 3D volumes that are stored
> as a collection of 2D DICOM files ?, with multiple
> volumes being stored in the same directory ?
>
>
> BTW, please make sure that you put the Update()
> call inside a try/catch block. It is very likely
> that the reader is throwing an exception telling
> you what the problem is, and you may not be seeing
> this message. You will find many examples of how
> to use a try/catch block in the ITK Software Guide.
>
>
>     Regards,
>
>
>       Luis
>
>
> --------------------
> Ashish Singh wrote:
> > Hi,
> >
> > I am a newbie in ITK. I am writing a code which involves reading and
> > writing multiple dicom files from a directory. These dicom files belong
> > to separate series. I was using a single file reader example within a
> > 'for' loop. But my code crashes when reader->update() is called the
> > second time. Can anyone please tell me what am I doing wrong? And how to
> > fix the problem?
> > Is there any other way to read and write multiple dicom files. I already
> > tried the imageseriesread and write, even that gives me error when there
> > is only one dicom file from a particular series in my directory.
> > What is the best way to do this? Is there any class/function that can do
> > this for me? Please help.
> >
> > Thanks,
> > Ashish
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070116/b7dd462f/attachment.htm


More information about the Insight-users mailing list