<html 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 http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Arial;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello Sara,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please take a look at this example on readthedocs (part of the Examples found in the SimpleITK source):<o:p></o:p></p>
<p class="MsoNormal"><a href="http://simpleitk.readthedocs.io/en/latest/Examples/DicomSeriesReadModifyWrite/Documentation.html">http://simpleitk.readthedocs.io/en/latest/Examples/DicomSeriesReadModifyWrite/Documentation.html</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Writing a valid DICOM series which contains all of the tag information you need may be tricky, depending on the information you need to encode in the meta-data dictionary (private tags etc.).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As a side note, the problem you have with the series writer is that it is writing each of the images into its own series.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">      hope this helps<o:p></o:p></p>
<p class="MsoNormal">              Ziv<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Sara Gh <sg.ele.eng@gmail.com><br>
<b>Date: </b>Wednesday, June 21, 2017 at 10:19 AM<br>
<b>To: </b>"community@itk.org" <community@itk.org><br>
<b>Subject: </b>[ITK] Problem with Writing Dicom Series<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hello,  <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have a question regarding writing Dicom series using SimpleITK in Python. I read a 3D scan, resampled it, and stored it as a Dicom series. However, when I try to read the stored data, I am unable to load the whole 3D images and it only
 displays one of the slices. It seems that the header is corrupted. I would be thankful if someone could help me to fix this issue. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Here is my write method:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">def WriteDicomSeries(imagein,outDir):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    writer = sitk.ImageSeriesWriter()<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    filenames = [ outDir+'MR_{0:04}.dcm'.format(i) for i in range(imagein.GetSize()[2])] <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    writer.SetFileNames(filenames)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    writer.Execute(imagein)<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Sara<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>