[Insight-developers] Fastest way to label an array
Nicolas RANNOU
nrannou at bwh.harvard.edu
Tue Jun 30 12:02:37 EDT 2009
Hi Luis,
I'm working on an VTK image but I can convert it into ITK for processing.
My "array" is a 2D image, because if I process the whole volume, the time
of processing is too long (too many pixels to process through my loops).
I want to create the label map associated to this 2D image. But the time of
processing must be short (< 1 second), not depending (or just a little) on
the number of labels.
For example, now, the time of processing for a 300*300 array and 6 labels
is up to 10 seconds!
Which filter would you recommand to me for the conversion into itk ? I
usually use itkImageToVTKImageFilter and itkVTKImageToImageFilter but I'm
not sure that it is the "best".
(I need to get the result of the labelling as a vtkimagedata for
visualization)
I will have a look at itkImageClassifierFilter to see if it can solve my
problem!
Thanks for your help,
Nicolas
On Tue, 30 Jun 2009 11:37:18 -0400, Luis Ibanez <luis.ibanez at kitware.com>
wrote:
> Hi Nicolas,
>
> Could you please provide more context ?
>
> Are you doing this with ITK images ?
>
> Are you doing this with VTK images ?
>
>
> What you call an "array" is it really a 2D image ?
> or a 3D image ?
>
>
> The relationship between the "array" and the
> label map is not clearly described in your email.
>
>
> ...
>
> At first sight, you seem to be trying to rewrite the
> functionalities of the itkImageClassifierFilter...
>
>
>
> Thanks for any clarifications,
>
>
> Luis
>
>
> ----------------------------------------------------
> On Mon, Jun 29, 2009 at 1:08 PM, Nicolas Rannou
> <nrannou at bwh.harvard.edu>wrote:
>
>> Hi all,
>>
>> I'm currently trying to process an array, to create a label map
> associated
>> to this array.
>> The problem is that I want a fast processing and the method I use is too
>> slow.
>>
>> What I do:
>>
>> /------------------------------------------------------------/
>> for(i...){ // 2 for loops to go through the array
>> for(j...){
>> for(int k;k=0;k<nbOfLabels){ // A loop to test the value of the pixel
> to
>> know to which label associate it
>> if(ArrayToCreateTheLabelMap->GetScalarComponentAsDouble(i,j,...) > x
> &&
>> ArrayToCreateTheLabelMap->GetScalarComponentAsDouble(i,j,...) < y){
>> ArrayLabelMap->SetScalarComponentFromDouble(i,j) = k; //fill the
> label
>> map
>> }
>> }
>> }
>> }
>> /----------------------------------------------------------/
>> Do you have any suggestion to increase the time of processing?
>> Maybe should I use something else than Get/SetScalarComponent.
>> Is it possible to do a fast mapping, to say that all pixels (in the
> array
>> or in a volume) between x and y should be egal to 1, between w and z
> egal to
>> 2... instead of doing these loops?
>> With 2 labels, the time of processing is ok but as soon as the number of
>> label increases, it becomes too long.
>>
>> Thanks,
>>
>> Nicolas
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
More information about the Insight-developers
mailing list