<div dir="ltr">Hi Sonam,<div><br></div><div>The filter vtkImageChangeInformation can modify the spacing of the data:</div><div><br></div><div>ici = vtk.vtkImageChangeInformation()</div><div>ici.SetInputConnection(reader.GetOutputPort())</div><div>ici.SetOutputSpacing(0.859375, 0.859375, 5.0)</div><div><br></div><div> - David</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 13, 2017 at 11:19 AM, Sonam Wangyal <span dir="ltr"><<a href="mailto:sonam.wangyal@ryerson.ca" target="_blank">sonam.wangyal@ryerson.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span style="font-family:HelveticaNeue;font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">Hello! </span><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><span style="font-family:HelveticaNeue;font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">This is my first post in this community and just as a heads up I am a complete newbie. I am currently working on a project to segment ventricles from MRI scans of the brain (in MATLAB). I wanted to then extract the surface using vtkDiscreteMarchingCubes() and write it into an STL file using vtkSTLWriter(). </span><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><span style="font-family:HelveticaNeue;font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">My problem is with the PixelSpacing, the documentation says if there are multiple DICOM images then the 'z' value is the Spacing Between the Slices. But I am receiving (0.859375, 0.859375, 0.0). I don't know why it is giving me a 0.0, it should be a 5. I have tried with an single DICOM and it works properly it gave me a Slice Thickness which coincidentally is the same value as the Spacing Between the Slices. </span><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><span style="font-family:HelveticaNeue;font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">SO MY QUESTION IS: is there anyway to manually change the value? My code is down below, THANKS FOR YOUR HELP! </span><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><br style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><span style="font-size:13.44px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><font face="Monaco">import vtk <br><br>PathDicom = "./DICOMs/" <br>reader = vtk.vtkDICOMImageReader() <br>reader.SetDirectoryName(<wbr>PathDicom) <br>reader.Update() <br><br>print(reader.GetPixelSpacing()<wbr>) <br><br>dmc = vtk.vtkDiscreteMarchingCubes()<wbr> <br>dmc.SetInputConnection(reader.<wbr>GetOutputPort()) <br>dmc.GenerateValues(1, 1, 1) <br>dmc.Update() <br><br>writer = vtk.vtkSTLWriter() <br>writer.SetInputConnection(dmc.<wbr>GetOutputPort()) <br>writer.SetFileTypeToBinary() <br>writer.SetFileName("ventricle.<wbr>stl") <br>writer.Write()</font></span><div><div><font size="2" face="HelveticaNeue"><span style="background-color:rgb(255,255,255)"><i><br></i></span></font></div><div><font size="2" face="HelveticaNeue"><span style="background-color:rgb(255,255,255)">Cheers,</span></font></div><div>
<div><b style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;line-height:normal;background-color:rgb(255,255,255)">Sonam Wangyal</b><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;line-height:normal;background-color:rgb(255,255,255)"><font size="1" color="#666666">Electrical Engineering | BEng Candidate </font></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;line-height:normal;background-color:rgb(255,255,255)"><span style="color:rgb(102,102,102);font-family:Arial,sans-serif;font-size:x-small">The Faculty of Engineering and Architectural Science</span></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;line-height:normal;background-color:rgb(255,255,255)"><font size="1" color="#666666"><span style="font-family:Arial,sans-serif">E: <a href="mailto:sonam.wangyal@ryerson.ca" style="color:rgb(17,85,204)" target="_blank">sonam.wangyal@ryerson.ca</a></span></font></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-variant-ligatures:normal;line-height:normal;background-color:rgb(255,255,255)"><span style="color:rgb(102,102,102);font-family:Arial,sans-serif;font-size:x-small">C: <a href="tel:(647)%20779-2560" value="+16477792560" target="_blank">647.779.2560</a></span></div></div></div></div></div></blockquote></div></div></div>