[vtkusers] Some problem in using vtkImageGradient

Glen Lehmann glehmann at imaging.robarts.ca
Mon May 10 09:06:45 EDT 2004


Hi Wang,

Try working back from the vtkImageGradient Filter to make sure that the 
outputs all have 1 component.

i.e.  Start with

pGaussianSmooth->GetOutput()->GetNumberOfScalarComponents();

Somewhere along the pipeline it's likely not equal to 1.

Glen

On May 10, 2004, at 12:01 AM, wang minyou wrote:

> Hello Glen,
>
> Thank you very much  for your help.
> But SetNumberOfComponents() is not a member of vtkBMPReader. I found a 
> similar function SetNumberOfScalarComponents() but the error remains. 
> What do you think about that?
>
> Wang
>
>> From: Glen Lehmann <glehmann at imaging.robarts.ca>
>> To: "wang minyou" <wmy1024 at hotmail.com>
>> CC: Glen Lehmann <glehmann at imaging.robarts.ca>, vtkusers at vtk.org
>> Subject: Re: [vtkusers] Some problem in using vtkImageGradient
>> Date: Sun, 9 May 2004 09:48:03 -0400
>>
>> Hello Wang,
>>
>> I think that your bmpReader is assuming you have data with more than 
>> 1 component.  Try:
>>
>> bmpReader->SetNumberOfComponents(1);
>>
>> before you get the out put of the reader.
>>
>> Cheers,
>> Glen
>>
>> On May 9, 2004, at 2:47 AM, wang minyou wrote:
>>
>>> Hello everyone,
>>> I have some problem in using vtkImageGradient. According to the 
>>> example in vtk-doc, I use vtkImageGradient to do image processing. 
>>> But in runtime occurs some errors in vtkOutputWindow, which 
>>> says:vtkImageGradient (019200A0): Execute: input has more than one 
>>> components. The input to gradient should be a single component 
>>> image. Think about it. If you insist on using a color image then run 
>>> it though RGBToHSV then ExtractComponents to get the V components. 
>>> That's probably what you want anyhow.
>>> But I want to get the Gradient of the grey level of the image.How 
>>> can I do that? Has anybody
>>> done similar work before? Please help me.
>>> Thank you very much!
>>> some codes are as follow:
>>> vtkImageGaussianSmooth* 
>>> pGaussianSmooth=vtkImageGaussianSmooth::New(); 
>>> pGaussianSmooth->SetInput(bmpReader->GetOutput()); 
>>> pGaussianSmooth->SetStandardDeviation(1.0); 
>>> pGaussianSmooth->SetDimensionality(2); 
>>> pGaussianSmooth->SetRadiusFactors(10,10,0);
>>> vtkImageGradient* imgGradient=vtkImageGradient::New();  
>>> imgGradient->SetInput(pGaussianSmooth->GetOutput());  
>>> imgGradient->SetDimensionality(2);
>>> vtkImageMagnitude* imgMagnitude=vtkImageMagnitude::New();  
>>> imgMagnitude->SetInput(imgGradient->GetOutput());
>>>
>>> _________________________________________________________________
>>> 享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com
>>> _______________________________________________
>>> This is the private VTK discussion list. Please keep messages 
>>> on-topic. Check the FAQ at: 
>>> <http://public.kitware.com/cgi-bin/vtkfaq>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>
>
> 王敏尤
> wmy1024 at hotmail.com
>
> _________________________________________________________________
> 享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3482 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040510/8c411ca3/attachment.bin>


More information about the vtkusers mailing list