[vtkusers] RE: 14. Question about embedding VTK Window into SDI Application

Ed Chmiel Ed.Chmiel at practiceworks.com
Tue Aug 14 13:34:50 EDT 2007


There's an example SDI program in this folder:
\VTK\Source\VTK\GUISupport\MFC

I have successfully created an app based upon it. LMK if you need further assistance.

Ed Chmiel
Application Developer
PracticeWorks, Inc
Office: 800-262-8144 x72064 (Direct: 714-544-1356)
Email: Ed.Chmiel at PracticeWorks.com
 
-----Original Message-----
From: vtkusers-bounces+ed.chmiel=practiceworks.com at vtk.org [mailto:vtkusers-bounces+ed.chmiel=practiceworks.com at vtk.org] On Behalf Of vtkusers-request at vtk.org
Sent: Tuesday, August 14, 2007 9:01 AM
To: vtkusers at vtk.org
Subject: vtkusers Digest, Vol 40, Issue 14

Send vtkusers mailing list submissions to
	vtkusers at vtk.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://www.vtk.org/mailman/listinfo/vtkusers
or, via email, send a message with subject or body 'help' to
	vtkusers-request at vtk.org

You can reach the person managing the list at
	vtkusers-owner at vtk.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of vtkusers digest..."


Today's Topics:

   1. Re: Getting the scalar value from vtkCell (Mark Kobine)
   2. Fwd: offscreen with framebuffers (Evan Bollig)
   3. Re: Getting the scalar value from vtkCell (Dominik Szczerba)
   4. Re: Fwd: offscreen with framebuffers (Berk Geveci)
   5. updating image grabs from a video source (Mark E Roberts)
   6. Re: help needed setting up the colormap/lookuptable/mapper	in
      C++ (Eduardo K. Saldanha)
   7. Re: Compile vtk 5.0.3 with Active Tcl8.4 and CMake 2.4
      (Lars Nygard)
   8. RE: help needed setting up the colormap/lookuptable/mapper	in
      C++ (David, John)
   9. looking for example points to vtk converter code. (David, John)
  10. Vtk building error en SUSE 10.1 (Jorge Manrique)
  11. itk::BinaryPruningImageFilter - How to set	Length/Iteration
      Parameters (Flo)
  12. Re: A mistake (Andrew Maclean)
  13. Re: help needed setting up the colormap/lookuptable/mapper	in
      C++ (Eduardo K. Saldanha)
  14. Question about embedding VTK Window into SDI Application
      (Neerav Patel)
  15. vtk 5 tcl package load problem on XP (David Sheinberg)
  16. RE: help needed setting up the colormap/lookuptable/mapper	in
      C++ (David, John)
  17. build things with vtk (yadin Bocuma Rivas)
  18. [vtkusers]How to put vtk render into custom control (??)
  19. Creating an Isosurface (Daniel Thorpe)
  20. Re: Creating an Isosurface (burlen)
  21. Re: Creating an Isosurface (burlen)
  22. Re: Creating an Isosurface (burlen)
  23. Re: iteratively update the vertices positions. (Meisam Aliroteh)


----------------------------------------------------------------------

Message: 1
Date: Mon, 13 Aug 2007 16:58:13 +0100
From: Mark Kobine <mark at bugless.co.uk>
Subject: Re: [vtkusers] Getting the scalar value from vtkCell
To: Dominik Szczerba <domi at vision.ee.ethz.ch>
Cc: vtkusers at vtk.org
Message-ID: <46C07F95.6070004 at bugless.co.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Dominik,

My geometry is arranged into a number of STL "solid" sections each of
which is comprised of many triangles. When the user clicks on the
geometry I want to "highlight" the whole "solid" section, not just the
individual triangle. The one thing that all the triangles in the same
section have in common is their scalar value. So I thought that I
may be able to use that.

Hope that helps to explain my thinking.

Many thanks,
Mark

Dominik Szczerba wrote:
> Hi Mark,
> I am not sure what you are after. Why do you need to have cells with the
> same scalar? I thought you just wanted to highlight a picked cell (or
> cells). In any case, you can get the scalar value by
> dataset->GetCellData()-> ... and getting you array by name for example.
> But I dont see why you would want that. You can extract the selected
> cell's edges and color their actor to your liking.
> - Dominik
> 
> Mark Kobine wrote:
>> Hi Dominik,
>>
>> Thanks for that - vtkExtractEdges looks like the way to go.
>>
>> What I think I need to do next is to get the set of cells that share the
>> same scalar value (as allocated by vtkSTLReader with ScalarTagsOn())
>> when the STL file was read in. I can get the cell the user clicked
>> easily with vtkCellPicker but I haven't been able to find anything that
>> will give me that cell's scalar value or the rest of the cells with the
>> same scalar.
>>
>> Or am I approaching this the wrong way?
>>
>> Many thanks,
>> Mark
>>
>> Dominik Szczerba wrote:
>>> Hi Mark,
>>> Please make cc's to the mailing list.
>>> The easiest thing to set up (not necessarily the fastest to perform)
>>> would be to extract the picked selection and use the vtkExtractEdges
>>> filter on it. Then set linewidth to 2 or 3 and color to red in a
>>> corresponding actor.
>>> bye, Dominik
>>>
>>> Mark Kobine wrote:
>>>> Hi Dominik,
>>>>
>>>> Many thanks for the advice.
>>>>
>>>> If I were to go about plotting the edges of the selected geometry, as
>>>> you suggest, how would I go about this?
>>>>
>>>> Many thanks,
>>>> Mark
>>>>
>>>> Dominik Szczerba wrote:
>>>>> This has been frequently asked here. There is no way to change a cell
>>>>> color other than to change its scalar value. This is not elegant as you
>>>>> have to write to your original dataset, supposedly writing down the
>>>>> overwritten value temporarily and taking care it is written back when
>>>>> you un-pick. Then, you have to remember that the modified scalar has
>>>>> still go through a color lookup table to be seen and having it always
>>>>> e.g. red may not always be that trivial and robust.
>>>>> I would recommend a different way without modifying the actual data,
>>>>> like shrinking the element, plotting it edges, or annotating it's
>>>>> nodes etc.
>>>>> - Dominik
>>>>>
>>>>> Mark Kobine wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I have some geometry read in from an STL file that contains several
>>>>>> "solid" sections. These sections are currently coloured automatically
>>>>>> by vtk based on the scalar value assigned to each section as it is
>>>>>> read in. I want to change the appearance of one of these sections if
>>>>>> the user clicks on it in the renderer window.
>>>>>>
>>>>>> I'm using vtkCellPicker and from that I can get the selected vtkCell.
>>>>>> From there is there a way to get the scalar value for that cell?
>>>>>>
>>>>>> My approach is to use that scalar to somehow change the appearance of
>>>>>> all cells with the same scalar value.
>>>>>>
>>>>>> Can any one help? Is this a sensible approach?
>>>>>>
>>>>>> Many thanks,
>>>>>> Mark
>>>>>> _______________________________________________
>>>>>> This is the private VTK discussion list. Please keep messages
>>>>>> on-topic.
>>>>>> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
> 


------------------------------

Message: 2
Date: Mon, 13 Aug 2007 12:10:28 -0400
From: "Evan Bollig" <bollig at scs.fsu.edu>
Subject: [vtkusers] Fwd: offscreen with framebuffers
To: vtkusers <vtkusers at vtk.org>
Message-ID:
	<1e93c9c0708130910o59b00d7ak50ee4953a0641299 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hey, does anyone have details for building VTK 5.0+ with support for
offscreen rendering to hardware (framebuffers)? I only find
information from 2000 and 2004 regarding p-buffers and Xvfb. Surely
there is a more optimal way to do this today?  Development has been
fine with mesa offscreen but we definitely need hardware support for
production.

-- 
-Evan Bollig
bollig at gmail.com
bollig at scs.fsu.edu


------------------------------

Message: 3
Date: Mon, 13 Aug 2007 18:58:21 +0200
From: Dominik Szczerba <domi at vision.ee.ethz.ch>
Subject: Re: [vtkusers] Getting the scalar value from vtkCell
To: mark at bugless.co.uk
Cc: vtkusers at vtk.org
Message-ID: <46C08DAD.4060404 at vision.ee.ethz.ch>
Content-Type: text/plain; charset=ISO-8859-1

OK so your scene is a set of triangular surfaces and you want to
highlight one whole surface and not the picked cell alone. That is very
easily done with the vtkThresholdFilter. Do you have your surfaces
pre-marked with some (integer) ID? If not, you can run
vtkConnectivityFilter to mark the disconnected regions with different
integers. Else, you have to prepare some ID field beforehand yourself.
Then when you click you pick a cell, then you retrieve its domain ID,
then you threshold the whole scene using this scalar to extract only
this particular surface, then you run vtkExtractEdges to render
(red/thick) edges. It might be slow for big datasets though. First thing
to speed up would be to pre-compute the edges at the beginning.
- Dominik

Mark Kobine wrote:
> Hi Dominik,
> 
> My geometry is arranged into a number of STL "solid" sections each of
> which is comprised of many triangles. When the user clicks on the
> geometry I want to "highlight" the whole "solid" section, not just the
> individual triangle. The one thing that all the triangles in the same
> section have in common is their scalar value. So I thought that I
> may be able to use that.
> 
> Hope that helps to explain my thinking.
> 
> Many thanks,
> Mark
> 
> Dominik Szczerba wrote:
>> Hi Mark,
>> I am not sure what you are after. Why do you need to have cells with the
>> same scalar? I thought you just wanted to highlight a picked cell (or
>> cells). In any case, you can get the scalar value by
>> dataset->GetCellData()-> ... and getting you array by name for example.
>> But I dont see why you would want that. You can extract the selected
>> cell's edges and color their actor to your liking.
>> - Dominik
>>
>> Mark Kobine wrote:
>>> Hi Dominik,
>>>
>>> Thanks for that - vtkExtractEdges looks like the way to go.
>>>
>>> What I think I need to do next is to get the set of cells that share the
>>> same scalar value (as allocated by vtkSTLReader with ScalarTagsOn())
>>> when the STL file was read in. I can get the cell the user clicked
>>> easily with vtkCellPicker but I haven't been able to find anything that
>>> will give me that cell's scalar value or the rest of the cells with the
>>> same scalar.
>>>
>>> Or am I approaching this the wrong way?
>>>
>>> Many thanks,
>>> Mark
>>>
>>> Dominik Szczerba wrote:
>>>> Hi Mark,
>>>> Please make cc's to the mailing list.
>>>> The easiest thing to set up (not necessarily the fastest to perform)
>>>> would be to extract the picked selection and use the vtkExtractEdges
>>>> filter on it. Then set linewidth to 2 or 3 and color to red in a
>>>> corresponding actor.
>>>> bye, Dominik
>>>>
>>>> Mark Kobine wrote:
>>>>> Hi Dominik,
>>>>>
>>>>> Many thanks for the advice.
>>>>>
>>>>> If I were to go about plotting the edges of the selected geometry, as
>>>>> you suggest, how would I go about this?
>>>>>
>>>>> Many thanks,
>>>>> Mark
>>>>>
>>>>> Dominik Szczerba wrote:
>>>>>> This has been frequently asked here. There is no way to change a cell
>>>>>> color other than to change its scalar value. This is not elegant
>>>>>> as you
>>>>>> have to write to your original dataset, supposedly writing down the
>>>>>> overwritten value temporarily and taking care it is written back when
>>>>>> you un-pick. Then, you have to remember that the modified scalar has
>>>>>> still go through a color lookup table to be seen and having it always
>>>>>> e.g. red may not always be that trivial and robust.
>>>>>> I would recommend a different way without modifying the actual data,
>>>>>> like shrinking the element, plotting it edges, or annotating it's
>>>>>> nodes etc.
>>>>>> - Dominik
>>>>>>
>>>>>> Mark Kobine wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have some geometry read in from an STL file that contains several
>>>>>>> "solid" sections. These sections are currently coloured
>>>>>>> automatically
>>>>>>> by vtk based on the scalar value assigned to each section as it is
>>>>>>> read in. I want to change the appearance of one of these sections if
>>>>>>> the user clicks on it in the renderer window.
>>>>>>>
>>>>>>> I'm using vtkCellPicker and from that I can get the selected
>>>>>>> vtkCell.
>>>>>>> From there is there a way to get the scalar value for that cell?
>>>>>>>
>>>>>>> My approach is to use that scalar to somehow change the
>>>>>>> appearance of
>>>>>>> all cells with the same scalar value.
>>>>>>>
>>>>>>> Can any one help? Is this a sensible approach?
>>>>>>>
>>>>>>> Many thanks,
>>>>>>> Mark
>>>>>>> _______________________________________________
>>>>>>> This is the private VTK discussion list. Please keep messages
>>>>>>> on-topic.
>>>>>>> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>

-- 
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi


------------------------------

Message: 4
Date: Mon, 13 Aug 2007 13:02:19 -0400
From: "Berk Geveci" <berk.geveci at kitware.com>
Subject: Re: [vtkusers] Fwd: offscreen with framebuffers
To: "Evan Bollig" <bollig at scs.fsu.edu>
Cc: vtkusers <vtkusers at vtk.org>
Message-ID:
	<45d654b0708131002u665b593do8551240c8a0cc29f at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

VTK CVS head supports framebuffers (as well as osmesa, pbuffers and glxpixmaps)

-berk


On 8/13/07, Evan Bollig <bollig at scs.fsu.edu> wrote:
> Hey, does anyone have details for building VTK 5.0+ with support for
> offscreen rendering to hardware (framebuffers)? I only find
> information from 2000 and 2004 regarding p-buffers and Xvfb. Surely
> there is a more optimal way to do this today?  Development has been
> fine with mesa offscreen but we definitely need hardware support for
> production.
>
> --
> -Evan Bollig
> bollig at gmail.com
> bollig at scs.fsu.edu
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


------------------------------

Message: 5
Date: Mon, 13 Aug 2007 13:56:27 -0400 (EDT)
From: "Mark E Roberts" <mroberts at andrew.cmu.edu>
Subject: [vtkusers] updating image grabs from a video source
To: vtkusers at vtk.org
Message-ID: <3521.128.2.56.205.1187027787.squirrel at 128.2.56.205>
Content-Type: text/plain;charset=iso-8859-1

Dear All,

I am grabbing screenshots from an ultrasound machine and using successive images to create a 3D image with vtkImageReslice and vtkImageMathematics. At this point, the code is written to combine 15 images in a row along the z-axis. The images are, in fact, one image used 15 times. What I would like to expand the code to do is take 15 snapshots from the video source and combine those. Unfortunately, I am grabbing one snapshot and then using that 15 times.  I am looking for help in identifying a solution to how I can update my pipeline to use the new snapshots. I've included part of my code to illustrate what I am trying to accomplish.

Any and all help is much appreciated.

Sincerely,
Mark Roberts

int frame = 0;

	for(int i = 0; i<15; i++){

		PP1->Delete();
		change->Delete();
		full->Delete();
		add->Delete();		
		transform->Delete();

		//
		//Image is grabbed
		//If the ultrasound machine is hooked up, the image is grabbed through ->Grab()
		//if it is not, then a random picture is used and it is sent through the vtkJPEGReader
		//and vtkImageToStructuredPoints part of the pipeline to creat a similar data
		//

		grabber->Grab();
		frame = grabber->GetFrameCount();
		
		cout<<"Frame count = "<<frame<<endl;

		PP1 = vtkImageToStructuredPoints::New();
		PP1->SetInput(grabber->GetOutput());
		PP1->Update();
	
	
		change = vtkImageChangeInformation::New();
		change->SetInput( PP1->GetOutput() );
		change->Update();


		cout<<i<<" slice grabbed"<<endl;


		//
		//vtkTransform can modify the orientation and position of the picture as if it were
		//a 4x4 homogeneous matrix (there is a class that can do that) but the rotations and translations are 
		//easier to input and all the calculations are taken care of automatically.
		//For this transformation, we are moving the picture horizontally along the z-axis by one pixel
		//
		
		transform = vtkTransform::New();
		transform->Translate(0., 0., -1.0*i);

		//
		//The picture is transformed and placed into the 3D volume that we have created. This puts the picture into 
		//world coordinates and allows for easy manipulation and comparison between pictures.
		//The picture, set as the input, is added to the background, which is the ->SetInformationInput
		//
		add = vtkImageReslice::New();
		add->SetInput(change->GetOutput());
		add->SetInformationInput(vol);
		add->SetOutputDimensionality(3);
		add->SetResliceTransform(transform);
	
		
		cout<<"New Image Reslice"<<endl;

		//
		//vtkImageMathematics is a simple function that compares two sets of structured points
		//In the pictures, black has a scalar value of zero and white has a value of one
		//ImageMathematics compares the two voxels and takes the higher voxel values and then discards the two 
		//pictures and creates a new one. 
		//

		full = vtkImageMathematics::New();
		full->SetInput1(add->GetOutput());
		full->SetInput2(temp->GetOutput());
		full->SetOperationToMax();
		
		//
		//Delete the old temp so that a new one can be made for the next iteration
		//
		
		temp->Delete();

		temp = vtkImageReslice::New();
		temp->SetInput(full->GetOutput());
		
		
		
		cout<<"Recopy the new picture"<<endl<<endl;

	
	}

		pic->Delete();
		full->Delete();
		add->Delete();
		transform->Delete();


	cout<<"Done"<<endl;





-- 
Mark Roberts
Masters of Science, Project Student
CER Lab
Carnegie Mellon University

301-806-6529

MRoberts at andrew.cmu.edu
MeerkyJ at gmail.com



------------------------------

Message: 6
Date: Mon, 13 Aug 2007 14:57:37 -0300
From: "Eduardo K. Saldanha" <eks05 at inf.ufpr.br>
Subject: Re: [vtkusers] help needed setting up the
	colormap/lookuptable/mapper	in C++
To: "David, John" <john.david at uconn.edu>, vtkusers at vtk.org
Message-ID:
	<bf776b8b0708131057i7e20a790w8b990ded9948f376 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

put the header
#include "vtkPointData.h"

2007/8/13, David, John <john.david at uconn.edu>:
>
>
>
>
> > > > You could use vtkDoubleArray or vtkFloatArray to set up the scalars:
> > > >
> > > > vtkDoubleArray *scalars = vtkDoubleArray::New();
> > > > for (i=0; !in.eof() && in.good(); i++)
> > > > {
> > > >     in >>  v;
> > > >     scalars.InsertNextValue(v);
> > > > }
> > > > polyData->SetScalars(scalars);
> > >
> > >
> > > Hmmm...  That gives me a compile error:
>  > >
> > >  'class vtkPolyData' has no member named 'SetScalars'
> > >
> >
> > sorry,
> > polyData->GetPointData()->SetScalars(scalars);
>
> No problem.  This gives me the following compiler error:
>
> lidar_hack1.cpp: In function 'int main(int, char**)':
> lidar_hack1.cpp:139: error: invalid use of undefined type 'struct vtkPointData'
> /usr/include/vtk-5.0/vtkCell.h:48: error: forward declaration of 'struct vtkPointData'
>
> I thought that polyData->SetPoints(points) defined polyData's point data.
>
> Here is the salient code:
>
>     vtkPoints *points = vtkPoints::New();
>     vtkCellArray *polys = vtkCellArray::New();
>     vtkDoubleArray *scalars = vtkDoubleArray::New();
>
> ...
>       // set the points with
>       points->InsertPoint(i, x, y, z);
>       scalars->InsertNextValue(z);
> ...
>
>
>     vtkPolyData *polyData = vtkPolyData::New();
>     polyData->SetPoints(points);
>     polyData->SetPolys(polys);
>     polyData->GetPointData()->SetScalars(scalars);
>     polyData->Update();
>
>
>
>
> Also if it helps, some system info:
>
>   OS:   Gentoo Linux-2.6.21-r4
>   CXX:  g++ (GCC) 4.1.2
>   VTK:  5.0.3
>
>
>   Thanks,
>
>   EBo --
>


------------------------------

Message: 7
Date: Mon, 13 Aug 2007 12:13:49 -0700 (PDT)
From: Lars Nygard <lnygard at yahoo.com>
Subject: Re: [vtkusers] Compile vtk 5.0.3 with Active Tcl8.4 and CMake
	2.4
To: David Cole <david.cole at kitware.com>
Cc: vtkusers at vtk.org
Message-ID: <67899.25326.qm at web50203.mail.re2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi David,

My values are: TCL_Liabrary:    tcl/bin/tcl83.dll
                                    TK_Library:        tcl/bin/tk83.dll

There are also libraries in the /tcl/lib directory that have the same
name but Lib extension. I tried to set these but this didn't work either.

I now use the vtk binary to run tcl files. Im not sure, is there any difference
in using this or using the wrapped version??
As said before the error is mention in the link below but I don't know how they 
fixed it.
thanks for your mail.
lars

----- Original Message ----
From: David Cole <david.cole at kitware.com>
To: Lars Nygard <lnygard at yahoo.com>
Cc: vtkusers at vtk.org
Sent: Monday, August 13, 2007 8:10:57 AM
Subject: Re: [vtkusers] Compile vtk 5.0.3 with Active Tcl8.4 and CMake 2.4

What are the values of TCL_LIBRARY and TK_LIBRARY in your CMakeCache.txt file? It sounds like they may not be set correctly. If not, set them correctly and re-configure with CMake and try rebuilding.

If they are already apparently set correctly, then we'll need to dig deeper to figure this out...


HTH,
David


On 8/9/07, Lars Nygard <lnygard at yahoo.com> wrote:
hi,

Im trying to compile vtk5.0.3 with wrap_TCL on. Im using
CMake 2.4 and have tried ActiveTcl8.4 and 8.3. However
Im getting the same mistake in both cases. The error is
mentioned here (
http://www.kwwidgets.org/Wiki/KWWidgets/Projects/UIDesigner/HOWTOCompileVTK5MinGW)
 but I don't understand how they fixed it. Here's the error,
any help would be really nice:

c:\Insight\VTK\bin\libvtkRenderingTCL.a(
vtkTkImageViewerWidget.obj):vtkTkImageVi
ewerWidget.cxx:(.text+0xa4d): undefined reference to `_imp__TkWinChildProc at 16'
c:\Insight\VTK\bin\libvtkRenderingTCL.a(vtkTkImageViewerWidget.obj):vtkTkImageVi
ewerWidget.cxx:
(.text+0xb9d): undefined reference to `_imp__TkWinChildProc at 16'
c:\Insight\VTK\bin\libvtkRenderingTCL.a(vtkTkImageViewerWidget.obj):vtkTkImageVi
ewerWidget.cxx:(.text+0xbd7): undefined reference to `_imp__TkWinChildProc at 16'

c:\Insight\VTK\bin\libvtkRenderingTCL.a(vtkTkImageViewerWidget.obj):vtkTkImageVi
ewerWidget.cxx:(.text+0xd0e): undefined reference to `_imp__TkWinChildProc at 16'
c:\Insight\VTK\bin\libvtkRenderingTCL.a(vtkTkImageViewerWidget.obj
):vtkTkImageVi
ewerWidget.cxx:(.text+0xd48): undefined reference to `_imp__TkWinChildProc at 16'
c:\Insight\VTK\bin\libvtkRenderingTCL.a(vtkTkRenderWidget.obj):vtkTkRenderWidget
.cxx:(.text+0x1845): more undefined references to `_imp__TkWinChildProc at 16' foll

ow
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/vtk.exe] Error 1
mingw32-make[1]: *** [Wrapping/Tcl/CMakeFiles/vtk.dir/all] Error 2
mingw32-make: *** [all] Error 2



_________________________________________________________

Alt i én. Få Yahoo! Mail med adressekartotek, kalender og
notisblokk. http://no.mail.yahoo.com
_______________________________________________
This is the private VTK discussion list.

Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:

http://www.vtk.org/mailman/listinfo/vtkusers









      
_________________________________________________________
Alt i én. Få Yahoo! Mail med adressekartotek, kalender og
notisblokk. http://no.mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070813/619f940c/attachment.html

------------------------------

Message: 8
Date: Mon, 13 Aug 2007 17:16:51 -0400
From: "David, John" <john.david at uconn.edu>
Subject: RE: [vtkusers] help needed setting up the
	colormap/lookuptable/mapper	in C++
To: "Eduardo K. Saldanha" <eks05 at inf.ufpr.br>, <vtkusers at vtk.org>
Message-ID:
	<40AC6D73C2B95C4CA21B26B7BF380C400ED1F0 at EXCHANGED.mgmt.ad.uconn.edu>
Content-Type: text/plain;	charset="iso-8859-1"


> put the header
> #include "vtkPointData.h"

it is already in there...

Hmmm... tell you what.  At the end you will find a minimal case (but with full source) to reproduce this problem.


  EBo --

ps: I've appended the code instead of attaching it to the email just in case the server strips attachments by default.

===============================================


#include <cstdlib> 
#include <ctime> 
#include <iostream>

#include "vtkCellArray.h"

#include "vtkPoints.h"
#include "vtkPolyData.h"

#include "vtkPolyDataWriter.h"

#include "vtkDoubleArray.h"


using namespace std;


int 
main(int argc, char** argv)
{
    int i;
    int num_points = 100;

    double x,y,z; // data points
    double rnd_min=1.0, rnd_max=-1.0; // cache the range for SetScalarRange

	vtkPoints *points = vtkPoints::New();
    vtkDoubleArray *scalars = vtkDoubleArray::New();

    srand48((unsigned)time(NULL)); 

    for (i=0; i<num_points; i++)
    {
        // the original code read in XYZ triplets, but for testing
        // just randomly create XY and set the Z to be on a slanted
        // plane

        x = drand48();
        y = drand48();
        z = (x+y)/2.0;

        if (z < rnd_min) rnd_min = z;
        if (z > rnd_max) rnd_max = z;

        points->InsertPoint(i, x, y, z);

        scalars->InsertNextValue(z);
    }


	vtkCellArray *polys = vtkCellArray::New();

    polys->InsertNextCell(points->GetNumberOfPoints());
    for (i=0; i<points->GetNumberOfPoints(); i++)
    {
        polys->InsertCellPoint(i);
    }


	vtkPolyData *polyData = vtkPolyData::New();
	polyData->SetPoints(points);
	polyData->SetPolys(polys);

// problem line
polyData->GetPointData()->SetScalarRange( rnd_min, rnd_max );

    polyData->Update();


    vtkPolyDataWriter* writer1 = vtkPolyDataWriter::New();
    
    writer1->SetInput(polyData);
    writer1->SetFileName( "tst_points.vtk" );
    writer1->Update();
    
    writer1->Delete();

    return 0;
}


------------------------------

Message: 9
Date: Mon, 13 Aug 2007 17:38:44 -0400
From: "David, John" <john.david at uconn.edu>
Subject: [vtkusers] looking for example points to vtk converter code.
To: "vtkusers" <vtkusers at vtk.org>
Message-ID:
	<40AC6D73C2B95C4CA21B26B7BF380C400ED1F1 at EXCHANGED.mgmt.ad.uconn.edu>
Content-Type: text/plain;	charset="iso-8859-1"


I've looked through the c++ minimal example source and have not been able to figure out how to create a VTK dataset from XYZ triplets with a colormap based on the Z values.  I am looking to eventually take the Delaunay2D triangularization and other post processing, and generate VTK output files that are viewable with mayavi, paraview, etc.

Does anyone know of a program which does this or something similar I can study as an example.  

  Thanks and best regards,

  EBo --



------------------------------

Message: 10
Date: Mon, 13 Aug 2007 18:23:32 -0400
From: Jorge Manrique <manriquejl at cantv.net>
Subject: [vtkusers] Vtk building error en SUSE 10.1
To: vtkusers at vtk.org
Message-ID: <200708131823.32658.manriquejl at cantv.net>
Content-Type: text/plain;  charset="iso-8859-1"

Hello there.
I´m trying to build vtk, but at the very end I got this message:

Converting /home/jmanrique/software/VTK5.3/vtk-5.0.3/Filtering/Testing/Tcl/closedSplines.tcl
Conversion failed!
make[2]: *** [Filtering/Testing/Python/conversion_complete] Error 1
make[1]: *** 
[Filtering/Testing/Python/CMakeFiles/FilteringPythonTests.dir/all] Error 2
make: *** [all] Error 2

I find out that it is due by a python scrip called vtkTclToPyConvertor.py (in 
Utilities/vtkTclTest2Py directory). 

I also download the directory Utilities/vtkTclTest2Py from the CVS repository 
and the problem remain the same

I´m buiding en SUSE 10.1, python version 2.4.2

Any help will be appreciate,
Jorge


------------------------------

Message: 11
Date: Mon, 13 Aug 2007 19:14:06 -0400
From: Flo <snrf at no-log.org>
Subject: [vtkusers] itk::BinaryPruningImageFilter - How to set
	Length/Iteration Parameters
To: vtkusers <vtkusers at vtk.org>
Message-ID: <F8047174-F262-4E1B-BA51-5C1F4B0BF28A at no-log.org>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Dear all:

I am using BinaryThinningImagefilter in conjunction with  
BinaryPruningImagefilter.
After superimposing the thin skeleton with the prunned skeleton, I  
realized that the Pruning process doesn't have any effect (almost).

I did not find much information on how to set the Prunning Process  
parameters such as the length of the branches to be removed or the  
Iterations criterion (i.e. from every end point to the first branch  
junction - stupid but might be useful as a start).

Right now, I just have a:

typedef itk::BinaryPruningImagefilter<Imgtype, Imgtype> PrunedFilter;
PrunedFilter::Pointer FilteringProcess = PrunedFilter::New();
FilteringProcess->SetInput (thinning->GetOutput());
FilteringProcess->Update();

Once again, the thinning process is as expected, but the Pruning  
seems to start but stop after removing not even a whole branch.

Can anybody point me out to some more information on how to set this  
BinaryPruningImageFilter ? Are there any other reviewed  
skeletonization process in ITK ?

regards,
Flo.


------------------------------

Message: 12
Date: Tue, 14 Aug 2007 10:17:12 +1000
From: "Andrew Maclean" <andrew.amaclean at gmail.com>
Subject: Re: [vtkusers] A mistake
To: JohnMark <zhaojunxp at hotmail.com>
Cc: vtkusers at vtk.org
Message-ID:
	<e7ddbec60708131717m513ce2fej4da3900e79809e8 at mail.gmail.com>
Content-Type: text/plain; charset="gb2312"

Your problem is that MyFunction should be a class derived from vtkCommand.

You should do somethinfg like this:


class vtkStartCommand: public vtkCommand
{
  public:

  static vtkStartCommand *New() { return new vtkStartCommand; }

  virtual void Execute(vtkObject * caller, unsigned long, void * /* callData
*/)
 { std::cout << "Starting execution of " << caller->GetClassName() <<
std::endl; }

};

vtkSmartPointer<vtkStartCommand> sObserver =
vtkSmartPointer<vtkStartCommand>::New();

Then somewhere in your code:

...

sphereWidget->AddObserver(vtkCommand::StartEvent,sObserver);

...

I hope this helps,

  Andrew





On 8/13/07, JohnMark <zhaojunxp at hotmail.com> wrote:

> Hi,
> I am writing a program by vtkSphereWidget ( using C++ ) ,and I want to
> connect my render window with the mouse event , so I use the AddObserver()
> function , at the same time , I write a new function that could be invoked
> , its name is MyFunction() . As the usage of AddObserver() , my code is :
>         sphereWidget->AddObserver( InteractionEvent, MyFunction );
> but there is a error : 'unsigned long __thiscall
> vtkObject::AddObserver(unsigned long,class vtkCommand *,float)' : cannot
> convert parameter 2 from 'void' to 'class vtkCommand *' .
> So why is it ? and how can I use the AddObserver() ? Could you give me an
> example ? thank you !
>
> ------------------------------
> ÖйúÊ®´óÈÈÃÅÂÃÓξ°µã Á˽â¸ü¶àÐÅÏ¢£¡<http://search.msn.com/results.aspx?q=%E4%B8%AD%E5%9B%BD%E5%8D%81%E5%A4%A7%E9%A3%8E%E6%99%AF&mkt=zh-CN&form=QBRE>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/a28f1f77/attachment.htm

------------------------------

Message: 13
Date: Mon, 13 Aug 2007 22:16:04 -0300
From: "Eduardo K. Saldanha" <eks05 at inf.ufpr.br>
Subject: Re: [vtkusers] help needed setting up the
	colormap/lookuptable/mapper	in C++
To: "David, John" <john.david at uconn.edu>, vtkusers at vtk.org
Message-ID:
	<bf776b8b0708131816s7c354110n973a0370586d9ba0 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I only found the member setScalarRange in mappers, so i changed to the
setScalars as I had told

#include <cstdlib>
#include <ctime>
#include <iostream>

#include "vtkCellArray.h"

#include "vtkPoints.h"
#include "vtkPolyData.h"

#include "vtkPolyDataWriter.h"

#include "vtkDoubleArray.h"
#include "vtkPointData.h"


using namespace std;


int main(int argc, char** argv)
{
  int i;
  int num_points = 100;

  double x,y,z; // data points
  double rnd_min=1.0, rnd_max=-1.0; // cache the range for SetScalarRange

  vtkPoints *points = vtkPoints::New();
  vtkDoubleArray *scalars = vtkDoubleArray::New();

  srand48((unsigned)time(NULL));

  for (i=0; i<num_points; i++)
    {
      // the original code read in XYZ triplets, but for testing
      // just randomly create XY and set the Z to be on a slanted
      // plane

      x = drand48();
      y = drand48();
      z = (x+y)/2.0;

      if (z < rnd_min) rnd_min = z;
      if (z > rnd_max) rnd_max = z;

      points->InsertPoint(i, x, y, z);

      scalars->InsertNextValue(z);
    }


  vtkCellArray *polys = vtkCellArray::New();

  polys->InsertNextCell(points->GetNumberOfPoints());
  for (i=0; i<points->GetNumberOfPoints(); i++)
    {
      polys->InsertCellPoint(i);
    }


  vtkPolyData *polyData = vtkPolyData::New();
  polyData->SetPoints(points);
  polyData->SetPolys(polys);
  polyData->GetPointData()->SetScalars(scalars);

  polyData->Update();


  vtkPolyDataWriter* writer1 = vtkPolyDataWriter::New();

  writer1->SetInput(polyData);
  writer1->SetFileName( "tst_points.vtk" );
  writer1->Update();

  writer1->Delete();

  return 0;
}


2007/8/13, David, John <john.david at uconn.edu>:
>
> > put the header
> > #include "vtkPointData.h"
>
> it is already in there...
>
> Hmmm... tell you what.  At the end you will find a minimal case (but with full source) to reproduce this problem.
>
>
>   EBo --
>
> ps: I've appended the code instead of attaching it to the email just in case the server strips attachments by default.
>
> ===============================================
>
>
> #include <cstdlib>
> #include <ctime>
> #include <iostream>
>
> #include "vtkCellArray.h"
>
> #include "vtkPoints.h"
> #include "vtkPolyData.h"
>
> #include "vtkPolyDataWriter.h"
>
> #include "vtkDoubleArray.h"
>
>
> using namespace std;
>
>
> int
> main(int argc, char** argv)
> {
>     int i;
>     int num_points = 100;
>
>     double x,y,z; // data points
>     double rnd_min=1.0, rnd_max=-1.0; // cache the range for SetScalarRange
>
>         vtkPoints *points = vtkPoints::New();
>     vtkDoubleArray *scalars = vtkDoubleArray::New();
>
>     srand48((unsigned)time(NULL));
>
>     for (i=0; i<num_points; i++)
>     {
>         // the original code read in XYZ triplets, but for testing
>         // just randomly create XY and set the Z to be on a slanted
>         // plane
>
>         x = drand48();
>         y = drand48();
>         z = (x+y)/2.0;
>
>         if (z < rnd_min) rnd_min = z;
>         if (z > rnd_max) rnd_max = z;
>
>         points->InsertPoint(i, x, y, z);
>
>         scalars->InsertNextValue(z);
>     }
>
>
>         vtkCellArray *polys = vtkCellArray::New();
>
>     polys->InsertNextCell(points->GetNumberOfPoints());
>     for (i=0; i<points->GetNumberOfPoints(); i++)
>     {
>         polys->InsertCellPoint(i);
>     }
>
>
>         vtkPolyData *polyData = vtkPolyData::New();
>         polyData->SetPoints(points);
>         polyData->SetPolys(polys);
>
> // problem line
> polyData->GetPointData()->SetScalarRange( rnd_min, rnd_max );
>
>     polyData->Update();
>
>
>     vtkPolyDataWriter* writer1 = vtkPolyDataWriter::New();
>
>     writer1->SetInput(polyData);
>     writer1->SetFileName( "tst_points.vtk" );
>     writer1->Update();
>
>     writer1->Delete();
>
>     return 0;
> }
>


------------------------------

Message: 14
Date: Tue, 14 Aug 2007 03:51:13 +0000
From: Neerav Patel <neeravpatel at hotmail.com>
Subject: [vtkusers] Question about embedding VTK Window into SDI
	Application
To: <vtkusers at vtk.org>
Message-ID: <BAY117-W77BBFF5036692B13634CAA8DD0 at phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"

Hi
 
I need to embed VTK into an SDI Application, how can I achieve this.
 
Thanks in advance.
 
Neerav
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/a2944d1a/attachment.html

------------------------------

Message: 15
Date: Tue, 14 Aug 2007 01:19:03 -0400
From: "David Sheinberg" <David_Sheinberg at brown.edu>
Subject: [vtkusers] vtk 5 tcl package load problem on XP
To: "vtkusers at vtk.org" <vtkusers at vtk.org>
Message-ID: <d0f589b215838c4f88bbde97a2c3cb07 at yoshi.neuro.brown.edu>
Content-Type: text/plain; charset="us-ascii"

Hi,

I've successfully built vtk 5.0.3 using VC6 with shared libs and TCL wrappings on Windows XP (Tcl version is 8.4.15).  After the build, the resulting vtk.exe binary loads fine and the tcl tests work as expected (if I run with the vtk executable).  My problem is that on one of my XP machines (the machine I built on!), I can't successfully do a "package require vtk" with the generic tclsh84 or wish84 (as I get a 'couldn't load library "c:/usr/local/lib/vtk-5.0/bin/vtkCommonTCL.dll": could not find specified procedure').  However, the same vtk dlls load fine on other XP machines (using the same wish84.exe or tclsh84.exe).  Has anyone encountered such a problem or could someone perhaps give some pointers about how to track down this kind of dll load problem?  

 

Thanks in advance,

 

David Sheinberg

Brown University



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/2d4b5e24/attachment.htm

------------------------------

Message: 16
Date: Tue, 14 Aug 2007 03:02:09 -0400
From: "David, John" <john.david at uconn.edu>
Subject: RE: [vtkusers] help needed setting up the
	colormap/lookuptable/mapper	in C++
To: "Eduardo K. Saldanha" <eks05 at inf.ufpr.br>, <vtkusers at vtk.org>
Message-ID:
	<40AC6D73C2B95C4CA21B26B7BF380C400ED1F2 at EXCHANGED.mgmt.ad.uconn.edu>
Content-Type: text/plain;	charset="iso-8859-1"


Now that I've had some sleep I cannot figure out how I missed doing that the first time.  I actually thought I did.  Uggg...

Sorry for wasting your time.

  EBo --

-----Original Message-----
From: eduardoks at gmail.com on behalf of Eduardo K. Saldanha
Sent: Mon 8/13/2007 9:16 PM
To: David, John; vtkusers at vtk.org
Subject: Re: [vtkusers] help needed setting up the colormap/lookuptable/mapper in C++
 
I only found the member setScalarRange in mappers, so i changed to the
setScalars as I had told

...


------------------------------

Message: 17
Date: Tue, 14 Aug 2007 02:07:40 -0500 (CDT)
From: yadin Bocuma Rivas <conra2004 at yahoo.com>
Subject: [vtkusers] build things with vtk
To: vtkusers at vtk.org
Message-ID: <556886.55789.qm at web51306.mail.re2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

Skipped content of type multipart/alternative-------------- next part --------------
An embedded message was scrubbed...
From: yadin Bocuma Rivas <conra2004 at yahoo.com>
Subject: [vtkusers] build things with vtk
Date: Mon, 13 Aug 2007 05:50:13 -0500 (CDT)
Size: 5174
Url: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/8aa2f70f/attachment-0001.mht

------------------------------

Message: 18
Date: Tue, 14 Aug 2007 16:23:33 +0800 (CST)
From: ?? <chenmao47 at 163.com>
Subject: [vtkusers]How to put vtk render into custom control
To: vtkusers at vtk.org
Message-ID:
	<16302929.753561187079813287.JavaMail.coremail at bj163app62.163.com>
Content-Type: text/plain; charset="gbk"

Hi, I want to have VTK render inside a custom control instead of in its own window, i'v no idea how to do with it. Could anyone please send me an example? Many thanks for your attention! Jacky   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/1b7f2e86/attachment.html

------------------------------

Message: 19
Date: Tue, 14 Aug 2007 13:49:08 +0100
From: Daniel Thorpe <dt.mailinglists at mac.com>
Subject: [vtkusers] Creating an Isosurface
To: vtkusers at vtk.org
Message-ID: <ED2AA52F-3E9A-4A0C-B300-7C7E9EF0B74C at mac.com>
Content-Type: text/plain; charset="us-ascii"

Hi, I'm pretty new to VTK, and my book hasn't arrived yet, however  
I'm under a bit of pressure to get this task finished, so any help is  
really appreciated....

I have some weather data such as air temperature for a number of  
points across a country (so it's an unstructured grid), this data is  
retrieved from a database by my application (which is an OS X Cocoa  
app, using Obj-C/++). For each point I have a northing, easting and  
elevation, so x,y,z. I'm trying to plot some sort of isosurface, I've  
written some code which I think puts my data into a  
vtkUnstructuredGrid, which is pasted below.

- (vtkDataSet *)samplesAsVTKDataSet {
	
	vtkPoints		*newPts		= vtkPoints::New();
	vtkDoubleArray	*newScalars = vtkDoubleArray::New();
	PointValue		*point; // this is a class representing a value  
associated with a coordinate
	double xyz[2];
	int i, length = [samples count];

	for(i=0; i<length; i++) {
		point = [samples objectAtIndex:i];
		xyz[0] = [[point north] doubleValue];
		xyz[1] = [[point east] doubleValue];
		xyz[2] = [[point elev] doubleValue];
		newPts->InsertPoint(i,xyz);
		newScalars->InsertValue(i, [[point value] doubleValue]);
	}
	
	vtkUnstructuredGrid	*dataSet = vtkUnstructuredGrid::New();	
	dataSet->SetPoints(newPts);
	dataSet->GetPointData()->SetScalars(newScalars);

	newPts->Delete();
	newScalars->Delete();	
	
	return dataSet;
}

Now, I'm a little stuck, I think I need to create a vtkDataSetMapper,  
or maybe some sort of Filter - as I'm guessing somewhere in the  
pipeline I've got to define how vtk should interpolate between the  
points?

Anyway, if someone can point in the right direction that would be great.

Cheers
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/c368e34c/attachment-0001.htm

------------------------------

Message: 20
Date: Tue, 14 Aug 2007 09:27:28 -0400
From: burlen <burlen at apollo.sr.unh.edu>
Subject: Re: [vtkusers] Creating an Isosurface
To: Daniel Thorpe <dt.mailinglists at mac.com>
Cc: vtkusers at vtk.org
Message-ID: <46C1ADC0.5040405 at apollo.sr.unh.edu>
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/fdd0416c/attachment-0001.html

------------------------------

Message: 21
Date: Tue, 14 Aug 2007 09:54:06 -0400
From: burlen <burlen at apollo.sr.unh.edu>
Subject: Re: [vtkusers] Creating an Isosurface
To: Daniel Thorpe <dt.mailinglists at mac.com>
Cc: vtkusers at vtk.org
Message-ID: <46C1B3FE.4080009 at apollo.sr.unh.edu>
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/9865591f/attachment-0001.htm

------------------------------

Message: 22
Date: Tue, 14 Aug 2007 09:57:17 -0400
From: burlen <burlen at apollo.sr.unh.edu>
Subject: Re: [vtkusers] Creating an Isosurface
To: Daniel Thorpe <dt.mailinglists at mac.com>
Cc: vtkusers <vtkusers at vtk.org>
Message-ID: <46C1B4BD.3080501 at apollo.sr.unh.edu>
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/6d541dcb/attachment-0001.html

------------------------------

Message: 23
Date: Tue, 14 Aug 2007 10:07:33 -0400
From: "Meisam Aliroteh" <meisam.aliroteh at gmail.com>
Subject: Re: [vtkusers] iteratively update the vertices positions.
To: "Dongqing Chen" <dqchen at cvip.louisville.edu>
Cc: vtkusers at vtk.org
Message-ID:
	<394c464d0708140707g2742bf3epd39310d0aa12992f at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi Dongqing,

I know I'm getting bck to you with a bit of delay but I'm writting my thesis
now a days and I'm pretty busy with that. I still don't know what is causing
the problem since I haven't seen your code but here is a sample code for
modifying a polydata. Note that this code is not very effecient and I've
pasted it here only as an example:

#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkProperty.h"
#include "vtkPolyData.h"
#include "vtkCellArray.h"
#include "vtkPointData.h"
#include "vtkPolyDataNormals.h"
#include "vtkCamera.h"

vtkPolyData *MakeUnitCube()
{
        vtkPolyData *cube = vtkPolyData::New();
        vtkPoints *pnts = vtkPoints::New(); // vertices of the cube
        vtkCellArray *faces = vtkCellArray::New(); // faces of the cube

        double points[8][3] = { {-0.5,-0.5,0.5}, {-0.5,0.5,0.5}, {0.5,0.5,
0.5}, {0.5,-0.5,0.5},
                                         {-0.5,-0.5,-0.5}, {-0.5,0.5,-0.5},
{0.5,0.5,-0.5}, {0.5,-0.5,-0.5} };
        int faceIds[6][4] = { {3,2,1,0}, {0,1,5,4}, {6,5,1,2}, {3,7,6,2},
{4,7,3,0}, {4,5,6,7} };
        int i;

        for(i=0; i<8; i++)
        {
                pnts->InsertNextPoint( points[i] );
                if (i < 6)
                {
                        faces->InsertNextCell(4, faceIds[i]);
                }
        }

        cube->SetPoints( pnts );
        cube->SetPolys( faces );
        return cube;
}

void BuildPolyDataNormals(vtkPolyData *pd)
{
        vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
        normals->SetInput( pd );
        normals->ComputePointNormalsOn();
        normals->ComputeCellNormalsOff();
        normals->SplittingOff();
        normals->Update();
        pd->GetPointData()->SetNormals(
normals->GetOutput()->GetPointData()->GetNormals() );
        normals->Delete();
}

void DeformPoly(vtkPolyData *poly, vtkPolyData *polyNew)
{
        int numPoints = poly->GetNumberOfPoints();
        int i;
        double pnt[3];

        polyNew->CopyStructure(poly);
        for(i=0; i<numPoints; i++)
        {
                poly->GetPoint(i, pnt);
                polyNew->GetPoints()->SetPoint(i, pnt[0]*1.02, pnt[1]*1.04,
pnt[2]*1.06);
        }
}

void main()
{
        vtkRenderer *ren = vtkRenderer::New();
        vtkRenderWindow *renWin = vtkRenderWindow::New();
        renWin->SetSize(600,400);
        renWin->AddRenderer(ren);

        vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
        iren->SetInteractorStyle( vtkInteractorStyleTrackballCamera::New()
);
        iren->SetRenderWindow(renWin);

        vtkPolyData *poly = MakeUnitCube(); // create a cube
        BuildPolyDataNormals(poly); // create it's point normals

        vtkPolyData *newPoly = vtkPolyData::New();
        int i=0;
        for(i=0; i<10; i++)
        {
                DeformPoly( poly, newPoly ); // call the function to deform
model based on curvature etc.
                BuildPolyDataNormals( newPoly ); // build normals of the new
shape
                poly->DeepCopy( newPoly ); // assign it back to poly to be
used in the next iteration
        }
        newPoly->Delete();
        /* I commented the following line because I'm going to render poly
onto screen. If you
          don't need to rendere it, then in your program you can delete poly
here ant it should work */
        // poly->Delete();

        vtkProperty *prop = vtkProperty::New();
        prop->SetAmbientColor(0.488566, 0.394212, 0.147212);
        prop->SetAmbient(1);
        prop->SetDiffuseColor(0.488566, 0.394212, 0.147212);
        prop->SetDiffuse(1);
        prop->SetSpecularColor(0.488566, 0.394212, 0.147212);
        prop->SetSpecular(1);
        prop->SetSpecularPower(51.2);

        vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
        mapper->SetInput( poly );
        mapper->GlobalImmediateModeRenderingOn();

        vtkActor *actor = vtkActor::New();
        actor->SetMapper( mapper );
        actor->SetProperty( prop );

        ren->AddActor(actor);
        ren->GetActiveCamera()->SetFocalPoint(0,0,0);
        ren->GetActiveCamera()->SetPosition(3,3,3);
        ren->GetActiveCamera()->OrthogonalizeViewUp();

        iren->Initialize();
        iren->Start();

        prop->Delete();
        mapper->Delete();
        actor->Delete();
        poly->Delete();
        ren->Delete();
        renWin->Delete();
        iren->Delete();
}



On 8/13/07, Dongqing Chen <dqchen at cvip.louisville.edu> wrote:
>
>  Hi, Meisam:
>
>    Thanks for your replying.
>
>    Actually, since I need to update all the new vertex positions based on
> their previous ones and some curvature flow criteria, during each iteration,
> I keep the previous polydate dataset structure, (say vtkPolypData
> *poly=vtkPolyData::New()), and assign the new vertex position to a newly
> generated polydata dataset polyNew. Finally during each iteration, I
> regenerate all the normals of polyNew, then I delete the poly and polyNew.
> Starting from a new interation, I transfer the normals to the poly which is
> generated again.
>
>   To be simple, let me summarize what I did:
>  1) create poly and polyNew;  poly takes the input dataset, while polyNew
> is designed to take the updated vertex positions during each iteration.
>     I am also thinking a question: how to keep the exact structures of
> poly and polyNew?
> 2). Based on its old position and curature flow criteria, I iteratively
> change the vertice position.
> 3). At the end of each iteration, I generate all the new normals of
> polyNew, which will be transfered to the poly generated in next iteration.
> 4). keep doing until all iterations are finished.
> 5). delete poly or polyNew during each iteration or after all the
> iterations, which really depends on where I create them, during
> each iteration or before all the iterations?
>
>  Hope it is more clear this time. Otherwise, I will post some patches of
> my code.
>
>
> Best Wishes,
> -----------------------------------------------------------------
> Dongqing Chen
> Ph.D Candidate
> Rm. 07, Paul C. Lutz Hall
> Computer Vision & Image Processing (CVIP) Lab
> Department of Electrical & Computer Engineering
> Speed School of Engineering
> University of Louisville
> Louisville, KY. 40292
> U.S.A
> Email: dqchen at cvip.louisville.edu
> Phone:+1-502-852-2789 (Lab)
>             +1-502-852-6130 (Office)
> -----------------------------------------------------------------
>
> ----- Original Message -----
> *From:* Meisam Aliroteh <meisam.aliroteh at gmail.com>
> *To:* Dongqing Chen <dqchen at cairo.spd.louisville.edu>
> *Cc:* vtkusers at vtk.org
> *Sent:* Sunday, August 12, 2007 8:07 PM
> *Subject:* Re: [vtkusers] iteratively update the vertices positions.
>
>
> Hi Dongqing,
>
> I have implemented programs where I update position of vertices in a
> for-loop and it never crashed. Basically the Delete() method will not crash
> just because you iteratively change vertex positions. If your program
> crashes, it is because of something else. From your explanation it is not
> clear what is the cause of the problem. Maybe you can give more details!?
> Also including parts of your code that is causing the problem can be very
> helpful.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/vtkusers/attachments/20070814/488ca5bd/attachment-0001.htm

------------------------------

_______________________________________________
vtkusers mailing list
vtkusers at vtk.org
http://www.vtk.org/mailman/listinfo/vtkusers


End of vtkusers Digest, Vol 40, Issue 14
****************************************



More information about the vtkusers mailing list