<font><font face="verdana,sans-serif">I think in VTK the origin is the lower-left corner.<br></font></font><br><div class="gmail_quote">On Fri, Dec 23, 2011 at 09:18, emreturkoz <span dir="ltr"><<a href="mailto:emreturkoz@gmail.com">emreturkoz@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a set of DICOM images which I read using ITK capabilities and convert<br>
into a VTK image then visualize using vtkImageViewer2.<br>
<br>
I want to create a new image data and visualize these two datasets together<br>
in one window. The problem is that the origin of the image that I created is<br>
always located on the lower end corner of the first image. I tried<br>
"SetOrigin" of image data but it doesn't work. What should I do to change<br>
the origin of the image? I use the following code:<br>
<br>
vtkImageData *image = vtkImageData::New();<br>
image->SetExtent(0,60,0,60,0,7);<br>
image->SetOrigin(10,10,4);<br>
image->SetDimensions(61,61,8);<br>
image->SetSpacing(1,1,1);<br>
image->Update();<br>
<br>
int* dims = image->GetDimensions();<br>
for (int z = 0; z < dims[2]; z++)<br>
{<br>
for (int y = 0; y < dims[1]; y++)<br>
{<br>
for (int x = 0; x < dims[0]; x++)<br>
{<br>
double* pixel = static_cast<double*>(image->GetScalarPointer(x,y,z));<br>
pixel[0] = 120;<br>
pixel[1] = 255;<br>
pixel[2] = 120;<br>
}<br>
}<br>
}<br>
image->SetScalarType(4);<br>
<br>
vtkImageBlend *blend = vtkImageBlend::New();<br>
blend->AddInput(itkvtkglue->GetOutput());<br>
blend->AddInput(image);<br>
blend->PRESERVES_RANGES();<br>
blend->SetOpacity(0,1.0);<br>
blend->SetOpacity(1,.4);<br>
<br>
pViewerXY->SetInput(blend->GetOutput());<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/vtkImageData-translating-the-origin-tp5096590p5096590.html" target="_blank">http://vtk.1045678.n5.nabble.com/vtkImageData-translating-the-origin-tp5096590p5096590.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</font></span></blockquote></div><br>