<div dir="ltr"><div><div><div>Hi if the scalar type is the same it could work for you. In other case you can create it with something like this:<br><br><span class="">// Create an image data</span>
  <br>vtkSmartPointer<span class=""><</span>vtkImageData<span class="">></span> imageData <span class="">=</span>
      vtkSmartPointer<span class=""><</span>vtkImageData<span class="">></span><span class="">::</span><span class="">New</span><span class="">(</span><span class="">)</span><span class="">;</span> 
<br><br><span class="">// Specify the size of the image data</span>
  <br><br>imageData<span class="">-</span><span class="">></span>SetDimensions<span class="">(</span><span class="">10</span>,<span class="">20</span>,<span class="">30</span><span class="">)</span><span class="">;<br><br></span></div><span class="">// allocate the data array<br></span>imageData<span class="">-</span><span class="">></span>AllocateScalars<span class="">(</span>VTK_CHAR,<span class=""> 1</span><span class="">)</span><span class="">;<br><br></span></div><span class="">HTH,<br></span></div><div><span class=""><br></span></div><span class="">Jorge<br><br></span><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-03 11:03 GMT+01:00 Zein Salah <span dir="ltr"><<a href="mailto:zeinsalah@gmail.com" target="_blank">zeinsalah@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I need to create mask of a vtkImageData, i.e., a binary image with<br>
exactly the same properties (dimensions, spacing, origin, etc.) of the<br>
original data image.<br>
<br>
For the creation,would a DeepCopy be ok or I would better create a new<br>
object and set the attributes like  img->SetExtent(...),<br>
img->SetSpacing(), etc.<br>
<br>
Thanks,<br>
Zeno<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 <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>