Discussion Forums: help

Monitor Forum | Start New Thread Start New Thread


RE: Properties (size, etc) on ImageComponent [ reply ]
By: Emmanuel Promayon on 2016-02-03 18:45
Dear Claire,

1) First two questions:
- where is the code that needs to access to this size in voxel?
- what is the purpose of getting this information?

2) A note about camitk::Properties:
camitk::Properties are here to provide an easy interface between the user and the data.
camitk::Properties are in fact an encapsulation of QObject Properties so that they can be used more easily in an ObjectController (see [1]).
So getting (or setting the values for non read-only properties) outside GUI interaction does not really seems the right things to do.

3) In your case:
The voxel size is read only, as it won't make any sense to modify its value. So for the voxel size, the corresponding property is just a way to automatize and simplify the information given to the user (through the GUI or not). I don't think there is any point to use a QVector3D unless you want to modify the rendering aspect of this property (what you have done on your screenshot).

4) A note about the CamiTK framework:
The underlying/encapsulated structure should always be available. This is the power of the toolkit: you can either use it at a high level to simplify GUI and quickly prototype your project, but as the same time, if you need to manipulate things at a low-level, it is possible.
For instance, ImageComponent encapsulates an vtkImageData. The vtkImageData is accessible using getImageData()

5) And to solve your problem:
ImageComponent *ic;
int dim[3]; // see [2]

Hope this helps...


RE: Properties (size, etc) on ImageComponent [ reply ]
By: Claire SERY on 2016-02-03 18:25

PropertyExplorer.png (19) downloads
Look at my screenshot to see the result...

Properties (size, etc) on ImageComponent [ reply ]
By: Claire SERY on 2016-02-03 17:34
Hi all,

I want to get the size in voxel of a 3D-image.

I don't want to use the method ImageComponent::getImageSize() because it is marked as depracated. So I try to use instead the camitk::Property as it is told in the header of the method.

First of all, I try to use the method ImageComponent::getProperty("Image Dimensions") (It has been a little bit difficult to find the name to pass in argument, but this is an other problem). I get a CamiTK::Property, but I can't do anything with that ! There is no method to get the curent value of the property.

Then I look to the ImageComponent::updateImageProperties() and I find that what I want is not a CamiTK::Property but a QObject::property() that returns a QVariant. Great ! I get the dimensions of my image !


This QVariant is a QString, and it has been constructed like this "(a,b,c)" where a, b, c are dimensions of the image.

Of course, it is now easy to get the information I need... I think that this QVariant is a QString to be displayed in the PropertyExplorer. But as it is Qt, it is very easy to display a QVector3D... This avoid to create a QString with the data returned by VTK and this avoid to extract numbers from this QString for me (and for everybody who needs to get basic information about his image...)

Can I change it ?

And, second question, why is there CamiTK::Property() (first point) that are not used ? I don't really understand it for ImageComponent...

Thank you for your answer !

Can I change it ?

Powered By FusionForge