And I inisilize this image by 0 and 1 depending on a certain conditions, using this code:
for (int x = extent; x < extent; x++)
** for (int y = extent; y < extent; y++)**
** for (int z = extent; z < extent; z++)**
** if(imageMTT->GetScalarComponentAsDouble(x, y, z, 0)>150)**
** imageTumor->SetScalarComponentFromDouble(x, y, z, 0, 1.0);**
** imageTumor->SetScalarComponentFromDouble(x, y, z, 0, 0.0);**
the question is how can visualize this image? i don't know if we can transform a vtkimagedata ona segment. any ideas to help me.
A small comment: GetScalarComponentAsDouble is intended for testing or get/set single values in a volume. It is not intended for filling an entire volume. It may be 10x or more slower than using VTK image filters or iterating through an image using a pointer. The loop in the example above is also much slower because the hottest loop jumps between slices instead of processing neighbor voxels (for (int x... for (int y... for (int z... should be changed to for (int z... for (int y... for (int x...). Processing all voxels in a single thread also slows down the operation. I would recommend to either learn more about how to implement image processing filters or use existing VTK filters to achieve reasonable processing speed. If you describe the processing you want to do (initialize this image by 0 and 1 depending on a certain conditions) then we may give advice on how to fill the volume more efficiently.
thanks for your responce and the important comment
I try to select the value of Perfusion parameters (MTT, TPP, rCBV, rCBF) from a vtkImageData object. And depending on those parameters, Idecide whether this voxel contains tumors or not.
After this, we obtain a vtkImagedata object (0 or 1) I need to visualize this object…
I agree that it would make sense to start prototyping in Python and then if you need better speed then vectorize the code and/or port slowest parts to C++. By “vectorizing” the operations I mean process an entire line, slice, or volume of voxels at a time (using numpy, ITK, or other tools) then you may be able to implement the whole computation in Python.
Note that there have been previous projects for processing time-resolved images, such PK modeling extension for analyzing DCE-MRI.
I’m not sure if there are CT perfusion modeling extensions (or algorithms that could be easily converted to extensions) for computing MTT, TP, rCBV, rCBF. @fedorov has features like this been developed as part of the QIICR project?