[Insight-users] RE: Reading and writing out DICOM images

Radhika Sivaramakrishna radhika.sivaramakrishna at synarc.com
Mon, 5 Jan 2004 07:24:33 -0800


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C3D3A0.056F1560
Content-Type: text/plain

Hi Luis,

I think it would be useful to have the capability to be able to save in
DICOM. For example, in my case, we receive a large number of cases of scans
taken at different times. The data are stored in DICOM format and directly
used for viewing etc. Often times, we would like to register a scan taken at
a later time to a baseline scan and resave data in the original DICOM format
instead of a new format. Also, sometimes we would like to add an overlay
(for example outline of an organ etc) on the original data and save that.
Does ITK support other formats, where I can conveniently associate an
overlay with a particular image etc?

Thanks
Radhika


-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
Sent: Tuesday, December 30, 2003 2:27 PM
To: Radhika Sivaramakrishna
Cc: 'insight-users at itk.org'
Subject: Re: Reading and writing out DICOM images


Hi Radhika,

There is no option in ITK for writing image as DICOM
slice files.

It is questionable whether you should save processed
files in DICOM format given that this format is mostly
intended for representing the data as originaly aquired
from scanners and in general from imaging devices.

What is your motivation for saving the images as
DICOM files ?

Is there a particular reason why you cannot use any
of the other formats available in ITK:

  - Analyze
  - MetaImage
  - VTK
  - GIPL
  - IPL
  - Stimulate
  - Brains2

You may find useful to take advantage of these
formats that provide a native representation for
3D data instead of saving it in groups of slice
files.


Please let us know,


  Thanks,



     Luis



------------------------------
Radhika Sivaramakrishna wrote:

> Hi Luis,
> Thanks for the detailed explanation and the code. If I want to write out 
> the image as another DICOM series in a different directory, what is the 
> procedure?
> 
> Radhika
> 
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
> Sent: Tuesday, December 30, 2003 1:17 AM
> To: Radhika Sivaramakrishna
> Cc: 'insight-users at itk.org'
> Subject: Re: Reading and writing out DICOM images
> 
> 
> Hi Radhika,
> 
> The DICOMImageIO by itself can only read 2D slices.
> 
> In order to read volumes from Dicom files you should
> use the ImageSeriesReader in combination with the
> DICOMSeriesFileNames class.
> 
> An example has been added to the repository for
> illustrating how to do this. You will find this
> example under
> 
>   Insight/Examples/IO/DicomSeriesReadImageWrite.cxx
> 
> Note that this example is using "unsigned short" as
> pixel type. If your Dicom files are coming from
> CT they are likely of pixel type "signed short".
> You may want to modify the code according to the
> real encoding of your data.
> 
> The code is pasted below:
> 
> --------------------------------------------------
> 
> #include "itkDICOMImageIO2.h"
> #include "itkImageSeriesReader.h"
> #include "itkDICOMSeriesFileNames.h"
> #include "itkImageFileWriter.h"
> 
> int main( int argc, char* argv[] )
> {
> 
>    if( argc < 3 )
>      {
>      std::cerr << "Usage: " << argv[0] << " DicomDirectory
> outputFileName  [seriesName]" << std::endl;
>      return EXIT_FAILURE;
>      }
> 
>    typedef itk::Image<unsigned short,3>            ImageType;
>    typedef itk::ImageSeriesReader< ImageType >     ReaderType;
> 
>    itk::DICOMImageIO2::Pointer dicomIO = itk::DICOMImageIO2::New();
> 
>    // Get the DICOM filenames from the directory
>    itk::DICOMSeriesFileNames::Pointer nameGenerator =
> itk::DICOMSeriesFileNames::New();
>    nameGenerator->SetDirectory( argv[1] );
> 
> 
>    typedef std::vector<std::string> seriesIdContainer;
>    const seriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
> 
>    seriesIdContainer::const_iterator seriesItr = seriesUID.begin();
>    seriesIdContainer::const_iterator seriesEnd = seriesUID.end();
> 
>    std::cout << std::endl << "The directory: " << std::endl;
>    std::cout << std::endl << argv[1] << std::endl << std::endl;
>    std::cout << "Contains the following DICOM Series: ";
>    std::cout << std::endl << std::endl;
> 
>    while( seriesItr != seriesEnd )
>      {
>      std::cout << seriesItr->c_str() << std::endl;
>      seriesItr++;
>      }
> 
>    std::cout << std::endl << std::endl;
>    std::cout << "Now reading series: " << std::endl << std::endl;
> 
>    typedef std::vector<std::string> fileNamesContainer;
>    fileNamesContainer fileNames;
> 
>    if( argc < 4 ) // If no optional third argument
>      {
>      std::cout << seriesUID.begin()->c_str() << std::endl;
>      fileNames = nameGenerator->GetFileNames();
>      }
>    else
>      {
>      std::cout << argv[3] << std::endl;
>      fileNames = nameGenerator->GetFileNames( argv[3] );
>      }
>    std::cout << std::endl << std::endl;
> 
>    ReaderType::Pointer reader = ReaderType::New();
>    reader->SetFileNames( fileNames );
>    reader->SetImageIO( dicomIO );
> 
>    try
>      {
>      reader->Update();
>      }
>    catch (itk::ExceptionObject &ex)
>      {
>      std::cout << ex << std::endl;
>      return EXIT_FAILURE;
>      }
> 
>    typedef itk::ImageFileWriter< ImageType > WriterType;
>    WriterType::Pointer writer = WriterType::New();
> 
>    std::cout  << "Writing the image as " << std::endl << std::endl;
>    std::cout  << argv[2] << std::endl << std::endl;
> 
>    writer->SetFileName( argv[2] );
> 
>    writer->SetInput( reader->GetOutput() );
> 
>    try
>      {
>      writer->Update();
>      }
>    catch (itk::ExceptionObject &ex)
>      {
>      std::cout << ex;
>      return EXIT_FAILURE;
>      }
> 
> 
>    return EXIT_SUCCESS;
> 
> }
> 
> 
> 
> --------------------------------------------------
> 
> 
> In order to use this program from the command line
> you must provide as first argument the directory
> where your DICOM slices are located, and as a second
> argument the filename of the output image. In order
> to produce Analyze you just need to provide an output
> filename with extension ".hdr". You could produce
> VTK files by using .vtk, or MetaImages by using .mhd.
> 
> Note that you may have multiple DICOM series in the
> same directory. The current program will simply take
> the first series.  If you want to select a particular
> series you can provide the optional third parameter
> with the string identifying the desired series.  If the
> optional parameter is missing, this example will print
> out all the available series and simply read the first
> one.
> 
> 
> 
> Please let us know if you have further questions,
> 
> 
>     Thanks
> 
> 
>       Luis
> 
> 
> ---------------------------------
> Radhika Sivaramakrishna wrote:
>  > Hi Luis,
>  >
>  > I was trying to modify the example in the Software guide to use an
>  > ImageIO class explicitly to read a DICOM series and write it out as a
3D
>  > Analyze format
>  >
>  > image. I am not sure how to specify the DICOM series in the input file
>  > name. I tried giving one of the files in the sequence [this only wrote
>  > out that particular slice]
>  >
>  >  as well as tried to use a *.dcm wildcard method which gave an error. I
>  > have the same doubt for writing out a DICOM series. How do I specify
the
>  > filename?
>  >
>  > 
>  >
>  > Thanks
>  >
>  > Radhika
>  >
>  > 
>  >
>  > -----------------------------------------------------
>  >
>  > Confidentiality Notice.
>  >
>  > This email message is for the sole use of the intended recipient(s) and
>  > may contain confidential and privileged information. Any unauthorized
>  > review, use, disclosure or distribution is prohibited. If you are not
>  > the intended recipient, please contact the sender by reply email and
>  > destroy all copies of the original message. If you are the intended
>  > recipient, please be advised that the content of this message is
subject
>  > to access, review and disclosure by the sender's Email System 
> Administrator.
>  >
> 
> 
>                                                     
> ----------------------------------------------------- 
> Confidentiality Notice.
> This email message is for the sole use of the intended recipient(s) and 
> may contain confidential and privileged information. Any unauthorized 
> review, use, disclosure or distribution is prohibited. If you are not 
> the intended recipient, please contact the sender by reply email and 
> destroy all copies of the original message. If you are the intended 
> recipient, please be advised that the content of this message is subject 
> to access, review and disclosure by the sender's Email System
Administrator.
> 


                                                     
-----------------------------------------------------  
Confidentiality Notice. 
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. If you are the intended recipient, please be
advised that the content of this message is subject to access, review and
disclosure by the sender's Email System Administrator.

------_=_NextPart_001_01C3D3A0.056F1560
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2656.87">
<TITLE>RE: Reading and writing out DICOM images</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi Luis,</FONT>
</P>

<P><FONT SIZE=3D2>I think it would be useful to have the capability to =
be able to save in DICOM. For example, in my case, we receive a large =
number of cases of scans taken at different times. The data are stored =
in DICOM format and directly used for viewing etc. Often times, we =
would like to register a scan taken at a later time to a baseline scan =
and resave data in the original DICOM format</FONT></P>

<P><FONT SIZE=3D2>instead of a new format. Also, sometimes we would =
like to add an overlay (for example outline of an organ etc) on the =
original data and save that.</FONT></P>

<P><FONT SIZE=3D2>Does ITK support other formats, where I can =
conveniently associate an overlay with a particular image etc?</FONT>
</P>

<P><FONT SIZE=3D2>Thanks</FONT>
<BR><FONT SIZE=3D2>Radhika</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Luis Ibanez [<A =
HREF=3D"mailto:luis.ibanez at kitware.com">mailto:luis.ibanez at kitware.com</=
A>] </FONT>
<BR><FONT SIZE=3D2>Sent: Tuesday, December 30, 2003 2:27 PM</FONT>
<BR><FONT SIZE=3D2>To: Radhika Sivaramakrishna</FONT>
<BR><FONT SIZE=3D2>Cc: 'insight-users at itk.org'</FONT>
<BR><FONT SIZE=3D2>Subject: Re: Reading and writing out DICOM =
images</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Hi Radhika,</FONT>
</P>

<P><FONT SIZE=3D2>There is no option in ITK for writing image as =
DICOM</FONT>
<BR><FONT SIZE=3D2>slice files.</FONT>
</P>

<P><FONT SIZE=3D2>It is questionable whether you should save =
processed</FONT>
<BR><FONT SIZE=3D2>files in DICOM format given that this format is =
mostly</FONT>
<BR><FONT SIZE=3D2>intended for representing the data as originaly =
aquired</FONT>
<BR><FONT SIZE=3D2>from scanners and in general from imaging =
devices.</FONT>
</P>

<P><FONT SIZE=3D2>What is your motivation for saving the images =
as</FONT>
<BR><FONT SIZE=3D2>DICOM files ?</FONT>
</P>

<P><FONT SIZE=3D2>Is there a particular reason why you cannot use =
any</FONT>
<BR><FONT SIZE=3D2>of the other formats available in ITK:</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; - Analyze</FONT>
<BR><FONT SIZE=3D2>&nbsp; - MetaImage</FONT>
<BR><FONT SIZE=3D2>&nbsp; - VTK</FONT>
<BR><FONT SIZE=3D2>&nbsp; - GIPL</FONT>
<BR><FONT SIZE=3D2>&nbsp; - IPL</FONT>
<BR><FONT SIZE=3D2>&nbsp; - Stimulate</FONT>
<BR><FONT SIZE=3D2>&nbsp; - Brains2</FONT>
</P>

<P><FONT SIZE=3D2>You may find useful to take advantage of these</FONT>
<BR><FONT SIZE=3D2>formats that provide a native representation =
for</FONT>
<BR><FONT SIZE=3D2>3D data instead of saving it in groups of =
slice</FONT>
<BR><FONT SIZE=3D2>files.</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Please let us know,</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>&nbsp; Thanks,</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; Luis</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>------------------------------</FONT>
<BR><FONT SIZE=3D2>Radhika Sivaramakrishna wrote:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; Hi Luis,</FONT>
<BR><FONT SIZE=3D2>&gt; Thanks for the detailed explanation and the =
code. If I want to write out </FONT>
<BR><FONT SIZE=3D2>&gt; the image as another DICOM series in a =
different directory, what is the </FONT>
<BR><FONT SIZE=3D2>&gt; procedure?</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Radhika</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>&gt; From: Luis Ibanez [<A =
HREF=3D"mailto:luis.ibanez at kitware.com">mailto:luis.ibanez at kitware.com</=
A>]</FONT>
<BR><FONT SIZE=3D2>&gt; Sent: Tuesday, December 30, 2003 1:17 AM</FONT>
<BR><FONT SIZE=3D2>&gt; To: Radhika Sivaramakrishna</FONT>
<BR><FONT SIZE=3D2>&gt; Cc: 'insight-users at itk.org'</FONT>
<BR><FONT SIZE=3D2>&gt; Subject: Re: Reading and writing out DICOM =
images</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Hi Radhika,</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; The DICOMImageIO by itself can only read 2D =
slices.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; In order to read volumes from Dicom files you =
should</FONT>
<BR><FONT SIZE=3D2>&gt; use the ImageSeriesReader in combination with =
the</FONT>
<BR><FONT SIZE=3D2>&gt; DICOMSeriesFileNames class.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; An example has been added to the repository =
for</FONT>
<BR><FONT SIZE=3D2>&gt; illustrating how to do this. You will find =
this</FONT>
<BR><FONT SIZE=3D2>&gt; example under</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp; =
Insight/Examples/IO/DicomSeriesReadImageWrite.cxx</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Note that this example is using &quot;unsigned =
short&quot; as</FONT>
<BR><FONT SIZE=3D2>&gt; pixel type. If your Dicom files are coming =
from</FONT>
<BR><FONT SIZE=3D2>&gt; CT they are likely of pixel type &quot;signed =
short&quot;.</FONT>
<BR><FONT SIZE=3D2>&gt; You may want to modify the code according to =
the</FONT>
<BR><FONT SIZE=3D2>&gt; real encoding of your data.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; The code is pasted below:</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; =
--------------------------------------------------</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; #include &quot;itkDICOMImageIO2.h&quot;</FONT>
<BR><FONT SIZE=3D2>&gt; #include =
&quot;itkImageSeriesReader.h&quot;</FONT>
<BR><FONT SIZE=3D2>&gt; #include =
&quot;itkDICOMSeriesFileNames.h&quot;</FONT>
<BR><FONT SIZE=3D2>&gt; #include =
&quot;itkImageFileWriter.h&quot;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; int main( int argc, char* argv[] )</FONT>
<BR><FONT SIZE=3D2>&gt; {</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; if( argc &lt; 3 )</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr =
&lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0] &lt;&lt; &quot; =
DicomDirectory</FONT>
<BR><FONT SIZE=3D2>&gt; outputFileName&nbsp; [seriesName]&quot; =
&lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
EXIT_FAILURE;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; typedef =
itk::Image&lt;unsigned =
short,3&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; ImageType;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; typedef =
itk::ImageSeriesReader&lt; ImageType &gt;&nbsp;&nbsp;&nbsp;&nbsp; =
ReaderType;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; itk::DICOMImageIO2::Pointer =
dicomIO =3D itk::DICOMImageIO2::New();</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; // Get the DICOM filenames =
from the directory</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; =
itk::DICOMSeriesFileNames::Pointer nameGenerator =3D</FONT>
<BR><FONT SIZE=3D2>&gt; itk::DICOMSeriesFileNames::New();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; =
nameGenerator-&gt;SetDirectory( argv[1] );</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; typedef =
std::vector&lt;std::string&gt; seriesIdContainer;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; const seriesIdContainer &amp; =
seriesUID =3D nameGenerator-&gt;GetSeriesUIDs();</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; =
seriesIdContainer::const_iterator seriesItr =3D =
seriesUID.begin();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; =
seriesIdContainer::const_iterator seriesEnd =3D seriesUID.end();</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl =
&lt;&lt; &quot;The directory: &quot; &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl =
&lt;&lt; argv[1] &lt;&lt; std::endl &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; =
&quot;Contains the following DICOM Series: &quot;;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl =
&lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; while( seriesItr !=3D =
seriesEnd )</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout =
&lt;&lt; seriesItr-&gt;c_str() &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
seriesItr++;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl =
&lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Now =
reading series: &quot; &lt;&lt; std::endl &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; typedef =
std::vector&lt;std::string&gt; fileNamesContainer;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; fileNamesContainer =
fileNames;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; if( argc &lt; 4 ) // If no =
optional third argument</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout =
&lt;&lt; seriesUID.begin()-&gt;c_str() &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileNames =3D =
nameGenerator-&gt;GetFileNames();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; else</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout =
&lt;&lt; argv[3] &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileNames =3D =
nameGenerator-&gt;GetFileNames( argv[3] );</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl =
&lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; ReaderType::Pointer reader =
=3D ReaderType::New();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; reader-&gt;SetFileNames( =
fileNames );</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; reader-&gt;SetImageIO( =
dicomIO );</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; try</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
reader-&gt;Update();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; catch (itk::ExceptionObject =
&amp;ex)</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout =
&lt;&lt; ex &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
EXIT_FAILURE;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; typedef =
itk::ImageFileWriter&lt; ImageType &gt; WriterType;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; WriterType::Pointer writer =
=3D WriterType::New();</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout&nbsp; &lt;&lt; =
&quot;Writing the image as &quot; &lt;&lt; std::endl &lt;&lt; =
std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; std::cout&nbsp; &lt;&lt; =
argv[2] &lt;&lt; std::endl &lt;&lt; std::endl;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; writer-&gt;SetFileName( =
argv[2] );</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; writer-&gt;SetInput( =
reader-&gt;GetOutput() );</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; try</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
writer-&gt;Update();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; catch (itk::ExceptionObject =
&amp;ex)</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout =
&lt;&lt; ex;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
EXIT_FAILURE;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp; return EXIT_SUCCESS;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; }</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; =
--------------------------------------------------</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; In order to use this program from the command =
line</FONT>
<BR><FONT SIZE=3D2>&gt; you must provide as first argument the =
directory</FONT>
<BR><FONT SIZE=3D2>&gt; where your DICOM slices are located, and as a =
second</FONT>
<BR><FONT SIZE=3D2>&gt; argument the filename of the output image. In =
order</FONT>
<BR><FONT SIZE=3D2>&gt; to produce Analyze you just need to provide an =
output</FONT>
<BR><FONT SIZE=3D2>&gt; filename with extension &quot;.hdr&quot;. You =
could produce</FONT>
<BR><FONT SIZE=3D2>&gt; VTK files by using .vtk, or MetaImages by using =
.mhd.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Note that you may have multiple DICOM series in =
the</FONT>
<BR><FONT SIZE=3D2>&gt; same directory. The current program will simply =
take</FONT>
<BR><FONT SIZE=3D2>&gt; the first series.&nbsp; If you want to select a =
particular</FONT>
<BR><FONT SIZE=3D2>&gt; series you can provide the optional third =
parameter</FONT>
<BR><FONT SIZE=3D2>&gt; with the string identifying the desired =
series.&nbsp; If the</FONT>
<BR><FONT SIZE=3D2>&gt; optional parameter is missing, this example =
will print</FONT>
<BR><FONT SIZE=3D2>&gt; out all the available series and simply read =
the first</FONT>
<BR><FONT SIZE=3D2>&gt; one.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Please let us know if you have further =
questions,</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Thanks</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; ---------------------------------</FONT>
<BR><FONT SIZE=3D2>&gt; Radhika Sivaramakrishna wrote:</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; Hi Luis,</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; I was trying to modify the example =
in the Software guide to use an</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; ImageIO class explicitly to read a =
DICOM series and write it out as a 3D</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; Analyze format</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; image. I am not sure how to specify =
the DICOM series in the input file</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; name. I tried giving one of the =
files in the sequence [this only wrote</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; out that particular slice]</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;&nbsp; as well as tried to use a =
*.dcm wildcard method which gave an error. I</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; have the same doubt for writing out =
a DICOM series. How do I specify the</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; filename?</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; Thanks</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; Radhika</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; =
-----------------------------------------------------</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; Confidentiality Notice.</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; This email message is for the sole =
use of the intended recipient(s) and</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; may contain confidential and =
privileged information. Any unauthorized</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; review, use, disclosure or =
distribution is prohibited. If you are not</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; the intended recipient, please =
contact the sender by reply email and</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; destroy all copies of the original =
message. If you are the intended</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; recipient, please be advised that =
the content of this message is subject</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; to access, review and disclosure by =
the sender's Email System </FONT>
<BR><FONT SIZE=3D2>&gt; Administrator.</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt;</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT =
SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&gt; =
----------------------------------------------------- </FONT>
<BR><FONT SIZE=3D2>&gt; Confidentiality Notice.</FONT>
<BR><FONT SIZE=3D2>&gt; This email message is for the sole use of the =
intended recipient(s) and </FONT>
<BR><FONT SIZE=3D2>&gt; may contain confidential and privileged =
information. Any unauthorized </FONT>
<BR><FONT SIZE=3D2>&gt; review, use, disclosure or distribution is =
prohibited. If you are not </FONT>
<BR><FONT SIZE=3D2>&gt; the intended recipient, please contact the =
sender by reply email and </FONT>
<BR><FONT SIZE=3D2>&gt; destroy all copies of the original message. If =
you are the intended </FONT>
<BR><FONT SIZE=3D2>&gt; recipient, please be advised that the content =
of this message is subject </FONT>
<BR><FONT SIZE=3D2>&gt; to access, review and disclosure by the =
sender's Email System Administrator.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
</P>
<BR>

<P><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT =
SIZE=3D2>-----------------------------------------------------&nbsp; =
</FONT>
<BR><FONT SIZE=3D2>Confidentiality Notice. </FONT>
<BR><FONT SIZE=3D2>This email message is for the sole use of the =
intended recipient(s) and may contain confidential and privileged =
information. Any unauthorized review, use, disclosure or distribution =
is prohibited. If you are not the intended recipient, please contact =
the sender by reply email and destroy all copies of the original =
message. If you are the intended recipient, please be advised that the =
content of this message is subject to access, review and disclosure by =
the sender's Email System Administrator.</FONT></P>

</BODY>
</HTML>
------_=_NextPart_001_01C3D3A0.056F1560--