[Insight-users] editing a volume

Luis Ibanez luis.ibanez@kitware.com
Tue, 24 Sep 2002 17:27:19 -0400


Hi Zein,

What kind of volume editing are you interested on ?

---

If you want to read isolated pixel values and
modify them one by one, the fltk::ImageViewer
could be enough.

This is not actually part of the ITK toolkit,
it is supplied just as an example of how to
interact with a GUI (FLTK in this case).

You will find this code in:

   Insight/Auxiliary/FltkImageViewer

on the files

    fltkImageViewer.h    and    .txx

The viewer uses an internal helper class
called

       GLSliceView

that can be found in the same directory.

GLSliceView uses OpenGl to render the slices
from a volume and also support mouse interaction.

You can register a callback for mouse clicks
with this class.  The callback is accessible
from the fltk::ImageViewer class.

just provide your callback by invoking:

     ClickSelectCallBack(  mycallbackFunction )

the callback function should have signature:

   void mycallbackFunction( float, float, float, void *)

the first three float parameters will be the spatial
coordinates of the pixel you clicked with the mouse.
The last void pointer is a custom pointer for you to
use.

An example of how to use this mechanims in a full
application can be seen on

   Insigtht/Examples/ThresholdSegmentationLevelSet

look in particular to the files:

    ThresholdSegmentationLevelSetBase.h
    ThresholdSegmentationLevelSetBase.cxx

Note that when the callback function is a member
method of a class it has to be a "static" method.

In this case the callback is:

     ClickSelectCallback(float,float,float,void *);

and the connection with the image viewer is done
like:

   m_InputImageViewer.ClickSelectCallBack(
                ClickSelectCallback, (void *)this);


In your case, you could modify the values of
the volume by accessing the pixels from the
"ClickSelectCallback" method.  Note that this
is done in the example for writing pixels

You may want to see the code running before trying
to use it for your own purposes.  Please try the

   ThresholdSegmentationLevelSet example.

Start by loading a volume with "Load" button, you
can display the volue using the "Input Image" button.
As you click (with the left mouse button) red dots
will be displayed on top of the image. (This is done
using the overlay function of the viewer). In your
own callback you can change this to setting new
pixel values for the original image.


Please let us know if you find any problems setting
up this interactive code.


Thanks,


   Luis



=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=


Zein Salah wrote:

> Hello friends,
>=20
> =20
>=20
> I need to edit a 3d volume, i.e, to play with the voxel value interacti=
vely.
>=20
> =20
>=20
> Can anybody advice me how to to that?
>=20
> what tool can do that? what programming need I to do if I want to do=20
> that myself?
>=20
> =20
>=20
> With many thanks for any type of help, guidance, or advice!!!
>=20
> =20
>=20
> Zein
>=20
> =20
>=20
> =20
>=20
> ->8<------------->8<------------->8<------------->8<------------->8<---=
---------->8<-
> Zein I. Salah
> Universit=E4t T=FCbingen, WSI-GRIS
> Sand 14
> 72076 T=FCbingen
> Email: salah@gris.uni-tuebingen.de <mailto:salah@gris.uni-tuebingen.de>=
 =20
> / zeinsalah@hotmail.com <mailto:zeinsalah@hotmail.com>
> Tel.: (07071) 29 75465 (GRIS) , (07071) 96 44 39 (privat)
>=20