[vtkusers] adding a member method to a vtk class

Budd Hirons bhiron at lsuhsc.edu
Thu Oct 14 11:36:59 EDT 2004


Hi Hamid,

Configure your CMakeLists.txt file in your vtkLocal folder to include 
your list of sources and your VTK kits includes.  be sure to follow the 
example and include LocalConfigure.h in your class header, then from the 
command line in that folder, run:

 > cmake .

CMake will load the VTK CMake file and produce a project to match that 
configuration.  the project result will be either vtkLocal.lib or 
vtkLocal.dll depending on your current VTK CMake setup.  Wrappers and 
tests will also be conveniently generated if that is how you are 
building VTK.

Cheers,
Budd.


listboss wrote:
> Thanks Andrew,
> 
> For now I just copied my methods to vtkImageReader and modified the
> headers to account for them.
> 
> But based on your and Leilda's repsonse, it seems that adding a new
> class is wiser and more efficient way of doing this.
> 
> If I do this, i.e. derive a class or add a new one, how can I make
> sure that it gets compiled to shared library (vtIO.dll under windows)
> ?
> 
> Thanks
> Hamid
> 
> 
> On Thu, 14 Oct 2004 09:30:59 +1000, Andrew Maclean <a.maclean at cas.edu.au> wrote:
> 
>>The best method is to derive from the class and add in your methods. Use
>>VTKLocal as the repository for your class if it is of general applicability
>>to other projects that you may be writing.
>>
>>In this way if vtkImageReader changes, a simple recompilation of VTKLocal is
>>all that is necessary.
>>
>>Works well for Windows and Linux. This also has the advantage that you can
>>write test routines and also put them into VTKLocal.
>>
>>
>>Andrew
>>
>>
>>
>>
>>-----Original Message-----
>>From: listboss [mailto:listboss at gmail.com]
>>Sent: Thursday, 14 October 2004 03:01
>>To: baghdadi at phenogenomics.ca
>>Cc: vtkusers at vtk.org
>>Subject: Re: [vtkusers] adding a member method to a vtk class
>>
>>Thanks Leila for the hints...
>>
>>As I said, I am trying to avoid creating a complete new class and
>>introduce it to vtk.
>>
>>Maybe it's better that I added my methods to vtkImageReader class
>>rather than keeping them in a seperate file/class.
>>
>>I'll try your suggestions and keep the list posted about the outcome.
>>
>>Thanks again
>>Hamid
>>
>>On 13 Oct 2004 12:48:14 -0400, Leila Baghdadi <baghdadi at sickkids.ca> wrote:
>>
>>>Hi Hamid
>>>
>>>you should try modifying CMakeList.txt if you are adding new classes,
>>>
>>>I think it is better to make your methods available in the class itself!
>>>
>>>try looking at the directory
>>>VTK/Examples/Build/vtkLocal
>>>
>>>you can place your class in the above directory, there is a
>>>CMakeLists.txt file in the above directory which is good enough to get
>>>you started,
>>>
>>>HTH
>>>
>>>Leila
>>>
>>>
>>>
>>>On Wed, 2004-10-13 at 12:27, listboss wrote:
>>>
>>>>Hi
>>>>
>>>>I have added a member function to vtkImageReader class. This new
>>>>function needs methods which are available in myclass.cpp
>>>>
>>>>To compile my modified vtkImageReader class, first I tried to add
>>>>myclass.cpp to the CMakeList.txt file located in IO folder, but the
>>>>linker complained about a missing instantiator !!! :(
>>>>
>>>>I removed the file from CMakeList.txt and I opened VisualStudio .Net,
>>>>right clicked on IO and selected "Add New Class" and then I added
>>>>"myclass.cpp" to "IO".
>>>>It compiles fine but my question is "Is it right way of doing this ?"
>>>>
>>>>Am I gonna see problems because how I am doing this, or it's just fine ?
>>>>How should I do this if I want to compile VTK under Linux ?
>>>>
>>>>Thanks in advance
>>>>Hamid
>>>>_______________________________________________
>>>>This is the private VTK discussion list.
>>>>Please keep messages on-topic. Check the FAQ at:
>>
>><http://public.kitware.com/cgi-bin/vtkfaq>
>>
>>>>Follow this link to subscribe/unsubscribe:
>>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 



More information about the vtkusers mailing list