[prev in list] [next in list] [prev in thread] [next in thread]
List: vtkusers
Subject: Re: [vtkusers] VTKImageActor->SetZSlice (z) fails to update
From: "Dr. Philip Julian Broser" <philip.broser () doctors ! net ! uk>
Date: 2010-03-30 17:15:47
Message-ID: 376CAA67-025A-42B5-850A-F0767D0CEC19 () doctors ! net ! uk
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi Eric,
I am using the
VTK 5.4.2
on Mac OS X 10.6 and 10.4
I have compiled the sources without using the Cocoa or Carbon library
so I assume the rendering is happening via the xwindow system.
I will set up a small example.
Greetings
Phil
On Mar 30, 2010, at 2:56 PM, Eric E. Monson wrote:
> Hey Phil,
>
> Is your VTK on 10.6 built using Cocoa or Carbon? And, which VTK
> version are you using on each machine?
>
> I don't know what the cause would be, but I know there are some
> differences and the info might be help the people who know more of
> the details track down the source of the inconsistent behavior.
>
> Thanks,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On Mar 29, 2010, at 4:18 PM, Dr. Philip Julian Broser wrote:
>
>> I tried that but it does not change the behavior of the program.
>>
>> But interestingly when I am compiling and using the software on a
>> machine running Mac OSX10.4 the slice updates without any problem,
>>
>> but when I am using 10.6 the problems starts.
>>
>> Does any body know anything about any buck on 10.6?
>>
>> On Mar 29, 2010, at 5:19 PM, Jothybasu K Selvaraj wrote:
>>
>>> You should be adding your Imageactor to some renderWindow. So,
>>> try RenderWindow->Render().
>>>
>>> Jothy
>>>
>>> On Mon, Mar 29, 2010 at 3:07 PM, Dr. Philip Julian Broser
>>> <philip.broser@doctors.net.uk> wrote:
>>> Dear VTK Users,
>>>
>>> I am still struggling with updating the zslice in the vtkImageActor
>>>
>>>
>>> I am visualising 3D Volume Data (tiff) using an vtkImageActor:
>>>
>>> vtkImageData *FaImage = (correctly loaded 3d volume data, see
>>> down below)
>>>
>>> vtkImageActor *ImageActor = vtkImageActor::New();
>>> ImageActor->SetInput (FaImage);
>>> ImageActor->SetZSlice (2);
>>>
>>> The visualisation of the first Zslice works very well.
>>>
>>> However my program visualizes 3D Volume MRI data and overlays it
>>> with vtk meshes of brain structures i.e. the thalmus.
>>> To check that the structure in the vtk mesh was correctly
>>> segmented and localized I want to look at single z planes.
>>> In order to be able to select different planes I have written a
>>> simple Event Class.
>>> With every click of the mouse the image plane should shift by one
>>> pixel in z.
>>> The first plane is always well visualised and the actor seems to
>>> be correctly initiated
>>> but the plane is not updated when a event occurs even so the
>>> command SetZSlice is called with the new z value.
>>>
>>> Does any body have an idea why the image actor is not updated?
>>>
>>> Kind regards
>>>
>>> Phil
>>>
>>>
>>> class myEventClass : public vtkCommand
>>> {
>>>
>>>
>>>
>>> virtual void Execute ( vtkObject * caller, unsigned long
>>> eventId, void * callData)
>>> {
>>> int max=ImageActor->GetWholeZMax ( );
>>> int min=ImageActor->GetWholeZMin ( );
>>>
>>>
>>> if (dir==0)
>>> {
>>> z=z+1;
>>> if (z>max ) {z=max;dir=1;}
>>> }
>>> else
>>> {
>>> z=z-1;
>>> if (z<min) {z=min;dir=0;}
>>> };
>>>
>>>
>>> ImageActor->SetZSlice (z);
>>>
>>>
>>> cout << "Current z Slice:" << z << endl;
>>> };
>>>
>>> public:
>>> myEventClass() {
>>> z=0;
>>> dir=0;
>>> }
>>>
>>> void SetImageActor(vtkImageActor *iA) {ImageActor=iA;};
>>>
>>>
>>> private:
>>> vtkImageActor *ImageActor;
>>> int z;
>>> int dir;
>>> };
>>>
>>>
>>> vtkImageData (0x101022350)
>>> Debug: Off
>>> Modified Time: 554
>>> Reference Count: 3
>>> Registered Events: (none)
>>> Source: (none)
>>> Information: 0x1010224b0
>>> Data Released: False
>>> Global Release Data: Off
>>> UpdateTime: 0
>>> Release Data: Off
>>> UpdateExtent: Not Initialized
>>> RequestExactExtent: Off
>>> Field Data:
>>> Debug: Off
>>> Modified Time: 456
>>> Reference Count: 1
>>> Registered Events: (none)
>>> Number Of Arrays: 0
>>> Number Of Components: 0
>>> Number Of Tuples: 0
>>> Number Of Points: 414720
>>> Number Of Cells: 397100
>>> Cell Data:
>>> Debug: Off
>>> Modified Time: 459
>>> Reference Count: 1
>>> Registered Events: (none)
>>> Number Of Arrays: 0
>>> Number Of Components: 0
>>> Number Of Tuples: 0
>>> Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
>>> Interpolate Flags: ( 1 1 1 1 1 0 0 )
>>> Pass Through Flags: ( 1 1 1 1 1 1 1 )
>>> Scalars: (none)
>>> Vectors: (none)
>>> Normals: (none)
>>> TCoords: (none)
>>> Tensors: (none)
>>> GlobalIds: (none)
>>> PedigreeIds: (none)
>>> Point Data:
>>> Debug: Off
>>> Modified Time: 552
>>> Reference Count: 1
>>> Registered Events: (none)
>>> Number Of Arrays: 1
>>> Array 0 name = NULL
>>> Number Of Components: 1
>>> Number Of Tuples: 414720
>>> Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
>>> Interpolate Flags: ( 1 1 1 1 1 0 0 )
>>> Pass Through Flags: ( 1 1 1 1 1 1 1 )
>>> Scalars:
>>> Debug: Off
>>> Modified Time: 452
>>> Reference Count: 2
>>> Registered Events: (none)
>>> Name: (none)
>>> Data type: unsigned char
>>> Size: 414720
>>> MaxId: 414719
>>> NumberOfComponents: 1
>>> Information: 0
>>> Name: (none)
>>> Number Of Components: 1
>>> Number Of Tuples: 414720
>>> Size: 414720
>>> MaxId: 414719
>>> LookupTable: (none)
>>> Array: 0x101100000
>>> Vectors: (none)
>>> Normals: (none)
>>> TCoords: (none)
>>> Tensors: (none)
>>> GlobalIds: (none)
>>> PedigreeIds: (none)
>>> Bounds:
>>> Xmin,Xmax: (0, 237.5)
>>> Ymin,Ymax: (0, 237.5)
>>> Zmin,Zmax: (0, 110)
>>> Compute Time: 0
>>> ScalarType: 3
>>> NumberOfScalarComponents: 1
>>> Spacing: (2.5, 2.5, 2.5)
>>> Origin: (0, 0, 0)
>>> Dimensions: (96, 96, 45)
>>> Increments: (0, 0, 0)
>>> Extent: (0, 95, 0, 95, 0, 44)
>>>
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://
>>> www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at: http://
>>> www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/
>> opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://
>> www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
[Attachment #5 (unknown)]
<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "> Hi Eric, <div><br></div><div>I am \
using the </div><div><br></div><div>VTK 5.4.2</div><div><br></div><div>on Mac OS \
X 10.6 and 10.4</div><div><br></div><div>I have compiled the sources without using \
the Cocoa or Carbon library </div><div>so I assume the rendering is happening \
via the xwindow system. </div><div><br></div><div>I will set up a small \
example.</div><div><br></div><div>Greetings</div><div><br></div><div>Phil</div><div><br><div><div>On \
Mar 30, 2010, at 2:56 PM, Eric E. Monson wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite"><div>Hey \
Phil,</div><div><br></div>Is your VTK on 10.6 built using Cocoa or Carbon? And, which \
VTK version are you using on each machine?<div><br></div><div>I don't know what the \
cause would be, but I know there are some differences and the info might be help the \
people who know more of the details track down the source of the inconsistent \
behavior.</div><div><br></div><div>Thanks,</div><div>-Eric</div><div><br><div> <span \
class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; \
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; \
"><div>------------------------------------------------------</div><div>Eric E \
Monson</div><div>Duke Visualization Technology Group</div><div><br \
class="webkit-block-placeholder"></div></span></div><br><div><div>On Mar 29, 2010, at \
4:18 PM, Dr. Philip Julian Broser wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: \
break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I \
tried that but it does not change the behavior of the program.<div><br></div><div>But \
interestingly when I am compiling and using the software on a machine running Mac \
OSX10.4 the slice updates without any problem,</div><div><br></div><div>but when I am \
using 10.6 the problems starts.</div><div><br></div><div>Does any body know anything \
about any buck on 10.6?</div><div><br></div><div><div>On Mar 29, 2010, at 5:19 PM, \
Jothybasu K Selvaraj wrote:</div><br class="Apple-interchange-newline"><blockquote \
type="cite"><div dir="ltr">You should be adding your Imageactor to some renderWindow. \
So, try RenderWindow->Render().<br><br>Jothy<br><br><div class="gmail_quote">On \
Mon, Mar 29, 2010 at 3:07 PM, Dr. Philip Julian Broser <span dir="ltr"><<a \
href="mailto:philip.broser@doctors.net.uk">philip.broser@doctors.net.uk</a>></span> \
wrote:<br> <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; \
border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: \
break-word;"><div>Dear VTK Users,</div><div><br></div><div>I am still struggling with \
updating the zslice in the vtkImageActor</div> <div><br></div><div><br></div><div>I \
am visualising 3D Volume Data (tiff) using an vtkImageActor:</div><div><font \
face="Menlo" size="3"><span style="font-size: \
11px;"><br></span></font></div><div><span style="font-family: Menlo; font-size: \
11px;">vtkImageData *FaImage = (correctly loaded 3d volume data, see down \
below)</span></div> <div><font face="Menlo" size="3"><span style="font-size: \
11px;"><br></span></font></div><div style="margin: 0px;">vtkImageActor *ImageActor = \
vtkImageActor::New();</div><div><font face="Menlo" size="3"><span style="font-size: \
11px;"><div style="margin: 0px;"> ImageActor->SetInput \
(FaImage); </div></span></font></div><div><div style="margin: \
0px;">ImageActor->SetZSlice (<font \
color="#3d00db">2</font>);</div></div><div><br></div><div>The visualisation of the \
first Zslice works very well. </div> <div><br></div><div>However my program \
visualizes 3D Volume MRI data and overlays it with vtk meshes of brain structures \
i.e. the thalmus.</div><div>To check that the structure in the vtk mesh was correctly \
segmented and localized I want to look at single z planes.</div> <div>In order to be \
able to select different planes I have written a simple Event \
Class. </div><div>With every click of the mouse the image plane should shift by \
one pixel in z. </div><div>The first plane is always well visualised and the \
actor seems to be correctly initiated </div> <div>but the plane is not updated \
when a event occurs even so the command SetZSlice is called with the new z \
value.</div><div><br></div><div>Does any body have an idea why the image actor is not \
updated?</div><div><br></div> <div>Kind \
regards</div><div><br></div><div>Phil</div><div><br></div><div><br></div><div><div \
style="margin: 0px;"><span style="color: rgb(204, 0, \
162);">class</span> myEventClass : <span style="color: rgb(204, 0, \
162);">public</span> vtkCommand</div> <div style="margin: 0px;">{</div><div \
style="margin: 0px; min-height: 13px;"><span style="white-space: \
pre;"> </span><br></div><div style="margin: 0px; min-height: 13px;"><br></div><div \
style="margin: 0px; min-height: 13px;"> <br></div><div style="margin: 0px;"><span \
style="white-space: pre;"> </span><span style="color: rgb(204, 0, \
162);">virtual</span> <span style="color: rgb(204, 0, \
162);">void</span> Execute<span style="white-space: pre;"> </span>( <span \
style="white-space: pre;"> </span>vtkObject * <span style="white-space: \
pre;"> </span>caller, <span style="color: rgb(204, 0, \
162);">unsigned</span> <span style="color: rgb(204, 0, \
162);">long</span> <span style="white-space: pre;"> </span>eventId, <span \
style="color: rgb(204, 0, 162);">void</span> * <span style="white-space: \
pre;"> </span>callData) <span style="white-space: pre;"> </span></div> <div \
style="margin: 0px;"><span style="white-space: pre;"> </span>{</div><div \
style="margin: 0px;"><span style="white-space: pre;"> </span><span style="color: \
rgb(204, 0, 162);">int</span> max=ImageActor->GetWholeZMax<span \
style="white-space: pre;"> </span>( );</div> <div style="margin: 0px;"><span \
style="white-space: pre;"> </span><span style="color: rgb(204, 0, \
162);">int</span> min=ImageActor->GetWholeZMin<span style="white-space: \
pre;"> </span>( );</div><div style="margin: 0px; min-height: 13px;"> <br></div><div \
style="margin: 0px; min-height: 13px;"><br></div><div style="margin: 0px;"><span \
style="white-space: pre;"> </span><span style="color: rgb(204, 0, \
162);">if</span> (dir==<span style="color: rgb(61, 0, 219);">0</span>)</div> \
<div style="margin: 0px;"><span style="white-space: pre;"> </span>{</div><div \
style="margin: 0px;"><span style="white-space: pre;"> </span>z=z+<span style="color: \
rgb(61, 0, 219);">1</span>;</div><div style="margin: 0px;"> <span style="white-space: \
pre;"> </span><span style="color: rgb(204, 0, 162);">if</span> (z>max ) \
{z=max;dir=<span style="color: rgb(61, 0, 219);">1</span>;}</div><div style="margin: \
0px;"><span style="white-space: pre;"> </span>}</div> <div style="margin: 0px; color: \
rgb(204, 0, 162);"><span style="color: rgb(0, 0, 0);"><span style="white-space: \
pre;"> </span></span>else</div><div style="margin: 0px;"><span style="white-space: \
pre;"> </span>{</div><div style="margin: 0px;"> <span style="white-space: \
pre;"> </span>z=z-<span style="color: rgb(61, 0, 219);">1</span>;</div><div \
style="margin: 0px;"><span style="white-space: pre;"> </span><span style="color: \
rgb(204, 0, 162);">if</span> (z<min) {z=min;dir=<span style="color: rgb(61, \
0, 219);">0</span>;}</div> <div style="margin: 0px;"><span style="white-space: \
pre;"> </span>};</div><div style="margin: 0px; min-height: 13px;"><span \
style="white-space: pre;"> </span><br></div><div style="margin: 0px; min-height: \
13px;"><span style="white-space: pre;"> </span><br> </div><div style="margin: \
0px;"><span style="white-space: pre;"> </span><b>ImageActor->SetZSlice \
(z);</b></div><div style="margin: 0px; min-height: 13px;"><span style="white-space: \
pre;"> </span><br></div><div style="margin: 0px; min-height: 13px;"> <span \
style="white-space: pre;"> </span><br></div><div style="margin: 0px;"><span \
style="white-space: pre;"> </span>cout << <span style="color: rgb(226, 3, \
0);">"Current z Slice:"</span> << z << endl;</div> <div \
style="margin: 0px;"><span style="white-space: pre;"> </span>};</div><div \
style="margin: 0px; min-height: 13px;"><span style="white-space: \
pre;"> </span><br></div><div style="margin: 0px; color: rgb(204, 0, 162);"><span \
style="color: rgb(0, 0, 0);"><span style="white-space: \
pre;"> </span></span>public<span style="color: rgb(0, 0, 0);">: </span></div> \
<div style="margin: 0px;"><span style="white-space: pre;"> </span>myEventClass() \
{</div><div style="margin: 0px;"><span style="white-space: pre;"> </span>z=<span \
style="color: rgb(61, 0, 219);">0</span>;</div><div style="margin: 0px;"> <span \
style="white-space: pre;"> </span>dir=<span style="color: rgb(61, 0, \
219);">0</span>; </div><div style="margin: 0px;"><span \
style="white-space: pre;"> </span>}<span style="white-space: pre;"> </span></div><div \
style="margin: 0px; min-height: 13px;"> <span style="white-space: \
pre;"> </span><br></div><div style="margin: 0px;"><span style="white-space: \
pre;"> </span><span style="color: rgb(204, 0, \
162);">void</span> SetImageActor(vtkImageActor *iA) {ImageActor=iA;};</div> <div \
style="margin: 0px;"><span style="white-space: pre;"> </span></div><div \
style="margin: 0px; min-height: 13px;"><span style="white-space: \
pre;"> </span><br></div><div style="margin: 0px; color: rgb(204, 0, \
162);">private<span style="color: rgb(0, 0, 0);">:</span></div> <div style="margin: \
0px;"><span style="white-space: pre;"> </span>vtkImageActor *ImageActor;</div><div \
style="margin: 0px;"><span style="white-space: pre;"> </span><span style="color: \
rgb(204, 0, 162);">int</span> z;</div> <div style="margin: 0px;"><span \
style="white-space: pre;"> </span><span style="color: rgb(204, 0, \
162);">int</span> dir;</div><div style="margin: 0px;">};</div><div \
style="margin: 0px;"><br></div><div style="margin: 0px;"> <br></div><div \
style="margin: 0px;"><div style="margin: 0px;">vtkImageData (0x101022350)</div><div \
style="margin: 0px;"> Debug: Off</div><div style="margin: \
0px;"> Modified Time: 554</div><div style="margin: \
0px;"> Reference Count: 3</div> <div style="margin: \
0px;"> Registered Events: (none)</div><div style="margin: \
0px;"> Source: (none)</div><div style="margin: \
0px;"> Information: 0x1010224b0</div><div style="margin: \
0px;"> Data Released: False</div><div style="margin: 0px;"> \
Global Release Data: Off</div><div style="margin: \
0px;"> UpdateTime: 0</div><div style="margin: 0px;"> Release \
Data: Off</div><div style="margin: 0px;"> UpdateExtent: Not \
Initialized</div><div style="margin: 0px;"> RequestExactExtent: Off</div> \
<div style="margin: 0px;"> Field Data:</div><div style="margin: \
0px;"> Debug: Off</div><div style="margin: 0px;"> \
Modified Time: 456</div><div style="margin: 0px;"> Reference \
Count: 1</div><div style="margin: 0px;"> Registered Events: \
(none)</div><div style="margin: 0px;"> Number Of Arrays: \
0</div><div style="margin: 0px;"> Number Of Components: 0</div><div \
style="margin: 0px;"> Number Of Tuples: 0</div><div style="margin: \
0px;"> Number Of Points: 414720</div><div style="margin: \
0px;"> Number Of Cells: 397100</div><div style="margin: \
0px;"> Cell Data:</div><div style="margin: 0px;"> Debug: \
Off</div><div style="margin: 0px;"> Modified Time: 459</div> <div \
style="margin: 0px;"> Reference Count: 1</div><div style="margin: \
0px;"> Registered Events: (none)</div><div style="margin: \
0px;"> Number Of Arrays: 0</div><div style="margin: \
0px;"> Number Of Components: 0</div> <div style="margin: \
0px;"> Number Of Tuples: 0</div><div style="margin: \
0px;"> Copy Tuple Flags: ( 1 1 1 1 1 0 1 )</div><div style="margin: \
0px;"> Interpolate Flags: ( 1 1 1 1 1 0 0 )</div><div \
style="margin: 0px;"> Pass Through Flags: ( 1 1 1 1 1 1 1 \
)</div><div style="margin: 0px;"> Scalars: (none)</div><div \
style="margin: 0px;"> Vectors: (none)</div><div style="margin: \
0px;"> Normals: (none)</div><div style="margin: 0px;"> \
TCoords: (none)</div><div style="margin: 0px;"> Tensors: \
(none)</div><div style="margin: 0px;"> GlobalIds: (none)</div><div \
style="margin: 0px;"> PedigreeIds: (none)</div><div style="margin: \
0px;"> Point Data:</div> <div style="margin: 0px;"> \
Debug: Off</div><div style="margin: 0px;"> Modified Time: \
552</div><div style="margin: 0px;"> Reference Count: 1</div><div \
style="margin: 0px;"> Registered Events: (none)</div><div \
style="margin: 0px;"> Number Of Arrays: 1</div><div style="margin: \
0px;"> Array 0 name = NULL</div><div style="margin: \
0px;"> Number Of Components: 1</div><div style="margin: \
0px;"> Number Of Tuples: 414720</div><div style="margin: 0px;"> \
Copy Tuple Flags: ( 1 1 1 1 1 0 1 )</div><div style="margin: \
0px;"> Interpolate Flags: ( 1 1 1 1 1 0 0 )</div><div \
style="margin: 0px;"> Pass Through Flags: ( 1 1 1 1 1 1 1 \
)</div><div style="margin: 0px;"> Scalars: </div> <div \
style="margin: 0px;"> Debug: Off</div><div style="margin: \
0px;"> Modified Time: 452</div><div style="margin: \
0px;"> Reference Count: 2</div><div style="margin: \
0px;"> Registered Events: (none)</div> <div style="margin: \
0px;"> Name: (none)</div><div style="margin: \
0px;"> Data type: unsigned char</div><div style="margin: \
0px;"> Size: 414720</div><div style="margin: \
0px;"> MaxId: 414719</div><div style="margin: 0px;"> \
NumberOfComponents: 1</div><div style="margin: \
0px;"> Information: 0</div><div style="margin: \
0px;"> Name: (none)</div><div style="margin: \
0px;"> Number Of Components: 1</div><div style="margin: \
0px;"> Number Of Tuples: 414720</div><div style="margin: \
0px;"> Size: 414720</div><div style="margin: \
0px;"> MaxId: 414719</div><div style="margin: \
0px;"> LookupTable: (none)</div><div style="margin: \
0px;"> Array: 0x101100000</div> <div style="margin: \
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic