remicres <[email protected]> wrote:
> 
> Hello Walid,
>
> Changing the default number of components per pixel of a filter's output has 
> to happen before memory allocation (I guess it will fail if you do it in 
> ThreadedGenerateData method). 
> You might add a "this->GetOutput()->SetNumberOfComponentsPerPixel(number)" in 
> the GenerateOutputInformation method. This should work because this method 
> precede buffer allocation.
>

Hi,

Yes, this is as least how I usually do it. I inherit from the filter
which does nearly what I want and overload the GenerateOutputInformation
method like this:

  void GenerateOutputInformation()
  {
    Superclass::GenerateOutputInformation();
    this->GetOutput()->SetNumberOfComponentsPerPixel( m_NumberOfOutputBands );
  }

See for example here:

http://tully.ups-tlse.fr/jordi/otb-bv/blob/master/src/applications/otbBVImageInversion.cxx#L78

Jordi

> Hope this helps!
>
> Rémi
>
> Le dimanche 28 juin 2015 14:54:13 UTC+2, Walid Bouceffa a écrit :
>
>  Hi,
>
>  I want to generate classification probabilities instead of labels, so I 
> start modifying otbImageClassifier app.
>  I changed OutputImageType from FloatImageType to DoubleVectorImageType in 
> aim to get a multi band image where each band represent the probabilities of 
> a single class
>
>  To get the probability I changed the method ThreadedGenerateData of the 
> class ImageClassificationFilter 
>  Something similar to the code bellow:
>
>  for (inIt.GoToBegin(), outIt.GoToBegin(); !inIt.IsAtEnd() && 
> !outIt.IsAtEnd(); ++inIt, ++outIt)
>  {
>  ....
>  // proba is an array with size = number of classes
>  outIt.Set( proba );
>  }
>
>  However outIt by default support only 4 components per pixel, 
>  I want to know how can i change this. I already tried 
> SetNumberOfComponentsPerPixel and it didn't work 
>
>  Could anyone help me with this ?
>
>  Best wishes,
>  Walid
>
>
> -- 

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to