<div dir="ltr"><div>Hi Eddy,</div><div><br></div><div>Can you provide the code that you used to write the image with vtkDICOMWriter?  Here is an example:</div><div><a href="http://dgobbi.github.io/vtk-dicom/doc/api/image_writer.html">http://dgobbi.github.io/vtk-dicom/doc/api/image_writer.html</a><br></div><div><br></div><div>Creating an image with a loop that calls GetScalarPointer() for every pixel is not very efficient, and casting to a "char *" when the data is "unsigned short" is wrong: you are setting only 8 bits of each 16-bit pixel, while leaving the other 8 bits uninitialized.  The vtkImageImport filter is a better way of generating image data:</div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageImport">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageImport</a><div><br></div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 24, 2017 at 2:51 AM, Eddy Cappeau <span dir="ltr"><<a href="mailto:edcpwk@gmail.com" target="_blank">edcpwk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>I'd like to use the vtkDICOMWriter class to convert a vtkImage to a set of DICOM images.<br></div><div><br>I've compile VTK with the vtkDICOM module enabled and followed the example from the pdf found on the github repository (<a href="http://dgobbi.github.io/vtk-dicom/doc/vtk-dicom.pdf" target="_blank">http://dgobbi.github.io/vtk-<wbr>dicom/doc/vtk-dicom.pdf</a>).<br><div><br></div><br>The image data is created like this :<br><br>    auto  img = vtkSmartPointer < vtkImageData >::New();<br>    img->SetOrigin(0, 0, 0);<br>    img->SetDimensions(1024, 1024, numlayer);<br>    img->SetSpacing(1, 1, 1);<br>    img->AllocateScalars(VTK_<wbr>UNSIGNED_SHORT, 1);<br><br></div>and the data filled like this : <br><br>           for (int n = 0; x < numlayer; n++) {<br>                for (int x = 0; x < 1024; x++) {<br>                    for (int y = 0; y < 1024; y++) {<br>                        char* pixel = static_cast<char*>(img-><wbr>GetScalarPointer(x, y, n));<br>                        pixel[0] = values[x][y];<br>                    }<br></div><div><br></div>I can load the converted result with paraview without problems.<br>But with 3D Slicer, I can just load the first file of the serie and it display a blank image.<br><br></div>What do I have to do to be able to load the images with both application ?<br></div><div><br>Thanks, <br><br></div>Eddy</div></blockquote></div><br></div></div></div>