<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Piotr,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">if you want to carry over metadata from input image to output image, you should save the metadata dictionary in a way similar to this:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">itk::MetaDataDictionary metadata;</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">template< typename TImage ></font></div><div class="gmail_default"><font face="monospace, monospace">itk::SmartPointer<TImage> readImage(std::string fileName)</font></div><div class="gmail_default"><font face="monospace, monospace">{</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::ImageFileReader<TImage> ReaderType;</font></div><div class="gmail_default"><font face="monospace, monospace"> typename ReaderType::Pointer reader = ReaderType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> reader->SetFileName(fileName.c_str());</font></div><div class="gmail_default"><font face="monospace, monospace"> try</font></div><div class="gmail_default"><font face="monospace, monospace"> {</font></div><div class="gmail_default"><font face="monospace, monospace"> reader->Update();</font></div><div class="gmail_default"><font face="monospace, monospace"> metadata = reader->GetMetaDataDictionary();</font></div><div class="gmail_default"><font face="monospace, monospace"> return reader->GetOutput();</font></div><div class="gmail_default"><font face="monospace, monospace"> }</font></div><div class="gmail_default"><font face="monospace, monospace"> catch (itk::ExceptionObject & error)</font></div><div class="gmail_default"><font face="monospace, monospace"> {</font></div><div class="gmail_default"><font face="monospace, monospace"> std::cerr << "Error: " << error << std::endl;</font></div><div class="gmail_default"><font face="monospace, monospace"> return NULL;</font></div><div class="gmail_default"><font face="monospace, monospace"> }</font></div><div class="gmail_default"><font face="monospace, monospace">}</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">template< typename TImage ></font></div><div class="gmail_default"><font face="monospace, monospace">void writeImage(itk::SmartPointer<TImage> image, std::string fileName)</font></div><div class="gmail_default"><font face="monospace, monospace">{</font></div><div class="gmail_default"><font face="monospace, monospace"> image->SetMetaDataDictionary(metadata); //full metadata</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::ImageFileWriter<TImage> WriterType;</font></div><div class="gmail_default"><font face="monospace, monospace"> typename WriterType::Pointer writer = WriterType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> writer->SetFileName(fileName.c_str());</font></div><div class="gmail_default"><font face="monospace, monospace"> writer->SetInput(image);</font></div><div class="gmail_default"><font face="monospace, monospace"> try</font></div><div class="gmail_default"><font face="monospace, monospace"> {</font></div><div class="gmail_default"><font face="monospace, monospace"> writer->Update();</font></div><div class="gmail_default"><font face="monospace, monospace"> }</font></div><div class="gmail_default"><font face="monospace, monospace"> catch (itk::ExceptionObject & error)</font></div><div class="gmail_default"><font face="monospace, monospace"> {</font></div><div class="gmail_default"><font face="monospace, monospace"> std::cerr << "Error: " << error << std::endl;</font></div><div class="gmail_default"><font face="monospace, monospace"> }</font></div><div class="gmail_default"><font face="monospace, monospace">}</font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 5, 2016 at 2:46 AM, Piotr Piasecki <span dir="ltr"><<a href="mailto:piotpia124@student.polsl.pl" target="_blank">piotpia124@student.polsl.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Sir or Madam.<br>
<br>
I am a student in Biomedical Engineering at the Silesian University of Technology. During my studies I worked with ITK and SimpleITK in C#. I want to use them in my current project, but I have an important question. After loading and processing a series of .dcm files I lost information about the patient and study to which they belong, and that they belong to one series. How can I keep this information?<br>
<br>
I will be very grateful for any answer.<br>
<br>
Best regards.<br>
<br>
Peter.<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>