[Insight-users] pixel type -- slcalar or non-scalar?

Peng (Patrick) Cheng peng-cheng at uiowa.edu
Wed Dec 8 13:46:45 EST 2004


Hi Julien,

I still have a question:
How do I check if the PixelType is a scalar or non-scalar?
Do you have an example for that?

Thanks

Patrick

Julien Jomier wrote:
> Hi Patrick,
> 
> This is correct. ITK doesn't have a general way of initializing both 
> scalar and vector type at this point. You can initialize scalar and 
> RGBPixel in the same function, but you have to create a separate 
> function/class for images of vectors.
> 
> Hope that helps,
> 
> Julien
> 
> Peng (Patrick) Cheng wrote:
> 
>> hi all,
>> I have following code:
>>
>>  InputPixelType p;
>>  if(InputPixelType::GetNumberOfComponents()>1){
>>    p.Fill(0);
>>  }
>>  else{
>>    p = NumericTraits<InputPixelType>::Zero;
>>  }
>>
>> When I pass the scalar pixel to this, it doesn't work.  Is that 
>> becasue of scalar type don't have GetNumberOfComponents() method?
>>
>> How to rewrite this code?
>>
>> Thanks
>>
>> Patrick
>>
> 

-- 

Peng (Patrick) Cheng
Research Assistant
Radiology, Magnetic Resonance Imaging (MRI) Center
University of Iowa Hospital and Clinics
Iowa City, IA 52246

Office:  0453-E JCP
Phone:   (319)356-7808 (O)
         (319)400-7442 (C)
Email:   peng-cheng at uiowa.edu
Website: http://css.engineering.uiowa.edu/~pcheng/





More information about the Insight-users mailing list