<div dir="ltr">Al, the code I have is using GDCM:<div>typedef itk::GDCMImageIO ImageIOType;<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 24, 2015 at 12:57 PM, AI <span dir="ltr"><<a href="mailto:audrey.istace@imavie.fr" target="_blank">audrey.istace@imavie.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Matias,<br>
<br>
Thank you for your answer.<br>
If your code is working with DCMTKImageIO and not GDCMImageIO, I would be happy to see it.<br>
For me it works using gdcm but not using dcmtk (compilation is ok, but no dicom is written in my output directory after execution), and I would like to use dcmtk.<br>
<br>
De : Matias Montroull [via ITK Insight Users] [mailto:<a href="mailto:ml-node%2Bs2283740n7587037h21@n2.nabble.com">ml-node+s2283740n7587037h21@n2.nabble.com</a>]<br>
Envoyé : mardi 24 mars 2015 16:11<br>
À : Audrey Istace<br>
Objet : Re: [ITK-users] itk - Writing dicom files from single 3D file<br>
<span class=""><br>
I'm able to write individual slices from a mha or mhd file, is that the same as nifti file? if so, I can send you the code, I think it's a copy/paste from one of the examples out there.<br>
<br>
</span><div><div class="h5">On Mon, Mar 23, 2015 at 12:11 PM, AI <[hidden email]</user/SendEmail.jtp?type=node&node=7587037&i=0>> wrote:<br>
Hello,<br>
<br>
I would like to write Dicom files from a nifti image files using<br>
DCMTKImageIO. In the code below, I read a nifti file using<br>
itkImageFileReader, and then try to write dicom files using<br>
itkImageSeriesWriter. I was not able to do it, probably because of the<br>
SetMetaDataDictionaryArray method, that I don’t know how to use since I<br>
don’t read dicom series as input. Can you help me with that ?<br>
<br>
Thank you very much,<br>
<br>
Audrey<br>
<br>
#include "itkDCMTKImageIO.h"<br>
#include "itkNumericSeriesFileNames.h"<br>
#include "itkImageFileReader.h"<br>
#include "itkImageSeriesWriter.h"<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
typedef signed short<br>
PixelType;<br>
const unsigned int<br>
Dimension = 3;<br>
typedef itk::Image< PixelType, Dimension ><br>
ImageType;<br>
typedef itk::Image< PixelType, 2 ><br>
OutputImageType;<br>
typedef itk::ImageFileReader< ImageType ><br>
ReaderType;<br>
typedef itk::DCMTKImageIO<br>
ImageIOType;<br>
typedef itk::NumericSeriesFileNames<br>
NamesGeneratorType;<br>
typedef itk::ImageSeriesWriter< ImageType, OutputImageType ><br>
WriterType;<br>
<br>
ImageIOType::Pointer dcmtkIO = ImageIOType::New();<br>
NamesGeneratorType::Pointer namesGenerator =<br>
NamesGeneratorType::New();<br>
ReaderType::Pointer reader = ReaderType::New();<br>
WriterType::Pointer writer = WriterType::New();<br>
<br>
reader->SetFileName( "../../out.nii" );<br>
reader->Update();<br>
<br>
<br>
<br>
itksys::SystemTools::MakeDirectory( "../../OutputDicom/" );<br>
<br>
std::string seriesFormat = "../../OutputDicom/IM%d.dcm";<br>
namesGenerator->SetSeriesFormat (seriesFormat.c_str());<br>
namesGenerator->SetStartIndex (1);<br>
namesGenerator->SetEndIndex (166);<br>
<br>
<br>
writer->SetInput( reader->GetOutput() );<br>
writer->SetImageIO( dcmtkIO );<br>
writer->SetFileNames( namesGenerator->GetFileNames() );<br>
// writer->SetMetaDataDictionaryArray(<br>
reader->GetMetaDataDictionaryArray() );<br>
writer->Update();<br>
}<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034.html</a><br>
Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>
_____________________________________<br>
</div></div>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<span class=""><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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<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://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>
<br>
_____________________________________<br>
</span>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<span class=""><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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<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://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>
________________________________<br>
</span>If you reply to this email, your message will be added to the discussion below:<br>
<a href="http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034p7587037.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034p7587037.html</a><br>
To unsubscribe from itk - Writing dicom files from single 3D file, click here<<a href="http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7587034&code=YXVkcmV5LmlzdGFjZUBpbWF2aWUuZnJ8NzU4NzAzNHw4NzExNjY2MzA=" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7587034&code=YXVkcmV5LmlzdGFjZUBpbWF2aWUuZnJ8NzU4NzAzNHw4NzExNjY2MzA=</a>>.<br>
NAML<<a href="http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</a>><br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034p7587040.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/itk-Writing-dicom-files-from-single-3D-file-tp7587034p7587040.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the ITK Insight Users mailing list archive at Nabble.com.<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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<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://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br></div>