I want to implement a new 3d reconstrcution method, in which I need to know gradient vector of each (i,j,k) voxel. The idea is to convert the binary label map to closed surface. The idea is similar to marching cube.

I know that I must apply vtkImageGradiant followed by VTKProbeFilter to get the gradint vector on each (i,j,k) voxel. But, It is wrong if I apply the vtkGradiantFilter on the LabelMap ( represented by 0 and 1 values). My question how can I recover the really scalar value of each voxel ( gray value for exemple of the segmented region) in order to apply the gradient filter on it .

If you need the gradient to estimate surface normal and you have a binary image then you need to first apply Gaussian smoothing filter on the labelmap.

Make sure that the smoothed results can be represented using the current scalar type and range of label values. For example, if you use int value as scalar type and labelmap values are 0 = background and 1 = foreground then you will get unusable results. You need to have label values of 0 and at least 100 (or use a float scalar type).

I have applied gaussian smoothing filter on the labelMap. Then I have applied the gradient filter on the smoothed image, but the majority of normal vectors are null (0,0,0). I know that is wrong. But I don’t understand how can I make sure that the smoothed results can be represented using the current scalar type and range of labelMap? and how can I get the label values between 0 and 100 for exemple. are there some tests or expressions that i must use

Hi Mr;
I have got good results when I applied vtkImageCast on the labelMap but with SetInputConnection but with SetInputData , I had wrong model . However, SetInputConnection(labelMap) causes an error because in the argument I must add Something like data->GetOutPourPort() which I can not do with vtkimagedata (labelMap)

the probleme is that setInputdata(labelmap) does not work.
with setInputConnection (labelMap) this is what is displayed (good results)

Is exactly what i am doing, I have used SetInputData with vtkImageData but I have not got not good results. however when I have used SetInputConnection with vtkImage Data, I have got like in the Screenshot result. with an error because setInputconnection must not be used with vtkImageData. Is there a solution to convert vtkImageData to an algorithm output without affect data? for exemple I found vtkTrivialProducer, or vtkPassThroughFilter?