<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi Ezequiel,<br><br>So happy that you are managed to solve the problem.Unfortunately, I'm just newer with ITK but if I have any thing to help every one I will do it even with the smallest knowledge that i have.<br>Thank you<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">De :</span></b> Ezequiel Geremia <t-egerem@microsoft.com><br><b><span style="font-weight: bold;">À :</span></b> Syrine Sahmim <syrine.sahmim@yahoo.fr><br><b><span style="font-weight: bold;">Cc :</span></b> "insight-users@itk.org" <insight-users@itk.org><br><b><span style="font-weight: bold;">Envoyé le
:</span></b> Mercredi, 24 Juin 2009, 0h26mn 40s<br><b><span style="font-weight: bold;">Objet :</span></b> RE: Re : [Insight-users] Output dicom series in new directory<br></font><br>
<style>
<!--
_filtered {font-family:"Cambria Math";panose-1:2 4 5 3 5 4 6 3 2 4;}
_filtered {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
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
        {color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
span.EmailStyle17
        {font-family:"Calibri", "sans-serif";color:#1F497D;}
.MsoChpDefault
        {font-size:10.0pt;}
_filtered {margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {}
-->
</style>
<div class="Section1">
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Hi Syrine,</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Thank you for your help</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">I managed to solve the problem by using NumericSeriesFileNames
class.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">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.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Attached the resulting code</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Many thanks,</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Ezequiel</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"> </span></p>
<div>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";" lang="EN-US">From:</span></b><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";" lang="EN-US"> 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</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">this is my code and you must
verify your cmake file<br>
#include "itkImageSeriesReader.h"<br>
#include "itkDICOMImageIO2.h"<br>
#include "itkDICOMSeriesFileNames.h"<br>
#include "itkImageFileWriter.h"<br>
<br>
int main( int argc, char* argv[] )<br>
{<br>
/*<br>
if( argc < 3 )<br>
{<br>
std::cerr << "Usage: " << argv[0]
<< " DicomDirectory outputFileName [seriesName]"
<< std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
*/<br>
<br>
argc = 2;<br>
argv[1] = "dicom";<br>
argv[2] = "dicomMRA.hdr";<br>
<br>
typedef
itk::Image<short,3>
ImageType;<br>
typedef itk::ImageSeriesReader< ImageType
> ReaderType;<br>
<br>
itk::DICOMImageIO2::Pointer dicomIO = itk::DICOMImageIO2::New();<br>
<br>
// Get the DICOM filenames from the directory<br>
itk::DICOMSeriesFileNames::Pointer nameGenerator =
itk::DICOMSeriesFileNames::New();<br>
nameGenerator->SetDirectory( argv[1] );<br>
<br>
<br>
try<br>
{<br>
typedef std::vector<std::string> seriesIdContainer;<br>
const seriesIdContainer & seriesUID =
nameGenerator->GetSeriesUIDs();<br>
<br>
seriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>
seriesIdContainer::const_iterator seriesEnd =
seriesUID.end();<br>
<br>
std::cout << std::endl << "The directory:
" << std::endl;<br>
std::cout << std::endl << argv[1] <<
std::endl << std::endl;<br>
std::cout << "Contains the following DICOM Series:
";<br>
std::cout << std::endl << std::endl;<br>
<br>
while( seriesItr != seriesEnd )<br>
{<br>
std::cout << seriesItr->c_str()
<< std::endl;<br>
seriesItr++;<br>
}<br>
<br>
std::cout << std::endl << std::endl;<br>
std::cout << "Now reading series: " <<
std::endl << std::endl;<br>
<br>
typedef std::vector<std::string> fileNamesContainer;<br>
fileNamesContainer fileNames;<br>
<br>
if( argc < 4 ) // If no optional third argument<br>
{<br>
std::cout << seriesUID.begin()->c_str()
<< std::endl;<br>
fileNames = nameGenerator->GetFileNames();<br>
}<br>
else<br>
{<br>
std::cout << argv[3] << std::endl;<br>
fileNames = nameGenerator->GetFileNames(
argv[3] );<br>
}<br>
std::cout << std::endl << std::endl;<br>
<br>
ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileNames( fileNames );<br>
reader->SetImageIO( dicomIO );<br>
<br>
try<br>
{<br>
reader->Update();<br>
}<br>
catch (itk::ExceptionObject &ex)<br>
{<br>
std::cout << ex << std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
typedef itk::ImageFileWriter< ImageType > WriterType;<br>
WriterType::Pointer writer = WriterType::New();<br>
<br>
std::cout << "Writing the image as "
<< std::endl << std::endl;<br>
std::cout << argv[2] << std::endl <<
std::endl;<br>
<br>
writer->SetFileName( argv[2] );<br>
<br>
writer->SetInput( reader->GetOutput() );<br>
<br>
try<br>
{<br>
writer->Update();<br>
}<br>
catch (itk::ExceptionObject &ex)<br>
{<br>
std::cout << ex;<br>
return EXIT_FAILURE;<br>
}<br>
}<br>
catch (itk::ExceptionObject &ex)<br>
{<br>
std::cout << ex;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
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>
</p>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<div class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";">
<hr size="1" width="100%" align="center">
</span></div>
<p class="MsoNormal"><b><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";">De
:</span></b><span style="font-size: 10pt; font-family: "Tahoma","sans-serif";">
Ezequiel Geremia <t-egerem@microsoft.com><br>
<b>À :</b> Mathieu Malaterre <mathieu.malaterre@gmail.com><br>
<b>Cc :</b> "insight-users@itk.org" <insight-users@itk.org><br>
<b>Envoyé le :</b> Mardi, 23 Juin 2009, 16h18mn 52s<br>
<b>Objet :</b> Re: [Insight-users] Output dicom series in new directory<br>
</span><span style="font-size: 10pt; 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 rel="nofollow" ymailto="mailto:mathieu.malaterre@gmail.com" target="_blank" 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 rel="nofollow" ymailto="mailto:insight-users@itk.org" target="_blank" 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<<a rel="nofollow" ymailto="mailto:t-egerem@microsoft.com" target="_blank" href="mailto:t-egerem@microsoft.com">t-egerem@microsoft.com</a>> wrote:<br>
> Hi insight-users,<br>
><br>
> I wrote a code inspired from itkSoftwraeGuide to convert nrrd files into
dicom series.<br>
><br>
> When running the executable on windows vista, the latter does not output
the dicom slices in the directory specified through<br>
><br>
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>
> NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();<br>
><br>
> namesGenerator->SetOutputDirectory( outputDirectory );<br>
><br>
> 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 rel="nofollow" target="_blank" href="http://www.kitware.com">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a rel="nofollow" target="_blank" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a rel="nofollow" target="_blank" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a></span></p>
</div>
</div>
</div>
<p class="MsoNormal"> </p>
</div>
</div></div></div><br>
</body></html>