<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>

<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi Syrine,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thank you for your help<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I managed to solve the problem by using NumericSeriesFileNames
class.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>However some issues remain unsolved due to incompatibility between
windows and unix path separators, that forces the executable to be used in the
same file as the the header.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Attached the resulting code<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Many thanks,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Ezequiel<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> Syrine Sahmim
[mailto:syrine.sahmim@yahoo.fr] <br>
<b>Sent:</b> 23 June 2009 18:55<br>
<b>To:</b> Ezequiel Geremia<br>
<b>Cc:</b> insight-users@itk.org<br>
<b>Subject:</b> Re : [Insight-users] Output dicom series in new directory<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'>this is my code and you must
verify your cmake file<br>
#include &quot;itkImageSeriesReader.h&quot;<br>
#include &quot;itkDICOMImageIO2.h&quot;<br>
#include &quot;itkDICOMSeriesFileNames.h&quot;<br>
#include &quot;itkImageFileWriter.h&quot;<br>
<br>
int main( int argc, char* argv[] )<br>
{<br>
/*<br>
&nbsp; if( argc &lt; 3 )<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0]
&lt;&lt; &quot; DicomDirectory&nbsp; outputFileName&nbsp; [seriesName]&quot;
&lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>
&nbsp;&nbsp;&nbsp; }<br>
*/<br>
<br>
&nbsp;&nbsp;&nbsp; argc = 2;<br>
&nbsp;&nbsp;&nbsp; argv[1] = &quot;dicom&quot;;<br>
&nbsp;&nbsp;&nbsp; argv[2] = &quot;dicomMRA.hdr&quot;;<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp; typedef
itk::Image&lt;short,3&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ImageType;<br>
&nbsp; typedef itk::ImageSeriesReader&lt; ImageType
&gt;&nbsp;&nbsp;&nbsp;&nbsp; ReaderType;<br>
<br>
&nbsp; itk::DICOMImageIO2::Pointer dicomIO = itk::DICOMImageIO2::New();<br>
<br>
&nbsp; // Get the DICOM filenames from the directory<br>
&nbsp; itk::DICOMSeriesFileNames::Pointer nameGenerator =
itk::DICOMSeriesFileNames::New();<br>
&nbsp; nameGenerator-&gt;SetDirectory( argv[1] );<br>
&nbsp; <br>
<br>
&nbsp; try<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; typedef std::vector&lt;std::string&gt; seriesIdContainer;<br>
&nbsp;&nbsp;&nbsp; const seriesIdContainer &amp; seriesUID =
nameGenerator-&gt;GetSeriesUIDs();<br>
<br>
&nbsp;&nbsp;&nbsp; seriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>
&nbsp;&nbsp;&nbsp; seriesIdContainer::const_iterator seriesEnd =
seriesUID.end();<br>
&nbsp; <br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; &quot;The directory:
&quot; &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; argv[1] &lt;&lt;
std::endl &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Contains the following DICOM Series:
&quot;;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>
<br>
&nbsp;&nbsp;&nbsp; while( seriesItr != seriesEnd )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; seriesItr-&gt;c_str()
&lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; seriesItr++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp; <br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;Now reading series: &quot; &lt;&lt;
std::endl &lt;&lt; std::endl;<br>
<br>
&nbsp;&nbsp;&nbsp; typedef std::vector&lt;std::string&gt; fileNamesContainer;<br>
&nbsp;&nbsp;&nbsp; fileNamesContainer fileNames;<br>
<br>
&nbsp;&nbsp;&nbsp; if( argc &lt; 4 ) // If no optional third argument<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; seriesUID.begin()-&gt;c_str()
&lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileNames = nameGenerator-&gt;GetFileNames();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; argv[3] &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileNames = nameGenerator-&gt;GetFileNames(
argv[3] );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; std::endl &lt;&lt; std::endl;<br>
<br>
&nbsp;&nbsp;&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>
&nbsp;&nbsp;&nbsp; reader-&gt;SetFileNames( fileNames );<br>
&nbsp;&nbsp;&nbsp; reader-&gt;SetImageIO( dicomIO );<br>
<br>
&nbsp;&nbsp;&nbsp; try<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;Update();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch (itk::ExceptionObject &amp;ex)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; typedef itk::ImageFileWriter&lt; ImageType &gt; WriterType;<br>
&nbsp;&nbsp;&nbsp; WriterType::Pointer writer = WriterType::New();<br>
<br>
&nbsp;&nbsp;&nbsp; std::cout&nbsp; &lt;&lt; &quot;Writing the image as &quot;
&lt;&lt; std::endl &lt;&lt; std::endl;<br>
&nbsp;&nbsp;&nbsp; std::cout&nbsp; &lt;&lt; argv[2] &lt;&lt; std::endl &lt;&lt;
std::endl;<br>
<br>
&nbsp;&nbsp;&nbsp; writer-&gt;SetFileName( argv[2] );<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; writer-&gt;SetInput( reader-&gt;GetOutput() );<br>
<br>
&nbsp;&nbsp;&nbsp; try<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;Update();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch (itk::ExceptionObject &amp;ex)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; ex;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; catch (itk::ExceptionObject &amp;ex)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; ex;<br>
&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp; return EXIT_SUCCESS;<br>
<br>
}<br>
<br>
i hope that will help you. tell wether your program goes on or not<br>
<br>
<br>
<br>
<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>

<hr size=1 width="100%" align=center>

</span></div>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De
:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
Ezequiel Geremia &lt;t-egerem@microsoft.com&gt;<br>
<b>À :</b> Mathieu Malaterre &lt;mathieu.malaterre@gmail.com&gt;<br>
<b>Cc :</b> &quot;insight-users@itk.org&quot; &lt;insight-users@itk.org&gt;<br>
<b>Envoyé le :</b> Mardi, 23 Juin 2009, 16h18mn 52s<br>
<b>Objet&nbsp;:</b> Re: [Insight-users] Output dicom series in new directory<br>
</span><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'><br>
No exception is thrown. The output dicom series are not created in the
requested Directory.<br>
<br>
Moreover Syrine, there is not a matter of reading nrrd format, it is just a
matter of outputting generated files in the right directory.<br>
<br>
If already have had that problem and resolve it you can send me the file so
that I can compare it with mine. It will help me solving that issue.<br>
<br>
Thanks,<br>
<br>
Ezequiel<br>
<br>
-----Original Message-----<br>
From: Mathieu Malaterre [mailto:<a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>]
<br>
Sent: 23 June 2009 16:11<br>
To: Ezequiel Geremia<br>
Cc: <a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>
Subject: Re: [Insight-users] Output dicom series in new directory<br>
<br>
On Tue, Jun 23, 2009 at 4:45 PM, Ezequiel Geremia&lt;<a
href="mailto:t-egerem@microsoft.com">t-egerem@microsoft.com</a>&gt; wrote:<br>
&gt; Hi insight-users,<br>
&gt;<br>
&gt; I wrote a code inspired from itkSoftwraeGuide to convert nrrd files into
dicom series.<br>
&gt;<br>
&gt; When running the executable on windows vista, the latter does not output
the dicom slices in the directory specified through<br>
&gt;<br>
&gt; typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>
&gt; NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();<br>
&gt;<br>
&gt; namesGenerator-&gt;SetOutputDirectory( outputDirectory );<br>
&gt;<br>
&gt; Do you have an idea on how to resolve that issue ?<br>
<br>
I have absolutely no idea. But if you send the output of the<br>
executable, I might help. just print the exception that's thrown<br>
during the call to Update() (or Write()) and send it to the list.<br>
<br>
2cts<br>
<br>
-- <br>
Mathieu<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a
href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><o:p></o:p></span></p>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>