[vtk-developers] TestSobel2D-image dashboard failures, anyone know anything about this?

Mathieu Coursolle mcoursolle at rogue-research.com
Mon Jul 9 09:24:42 EDT 2007


Hi,

I've made some tests with the sobel filter and I must admit that
I am a little confused.

I wrote a little test app, which looks like the TestSobel2D, but which 
creates its own image instead of using the DICOM reader. The results I
got make me think that the DICOM reader has nothing to do with the failure
of the TestSobel2D on Big endian machines.

My input image is a cross. If the input type is double, the output seems
good on both intel and PPC. However, if the input type is int, both the
output on intel and PPC are wrong. 

Even stranger, the wrong outputs are different on intel and PPC. My guess was
then that it is an endianness problem. However, if I run the PCC version of
the app on an intel Mac using Rosetta (PPC emulation), I get the same result
as if I use the intel version.

I attached the results I got. Anyone has a clue of:
1- Why the output is different when the input is not double?
2- Why is the outputs different on PPC and intel?

Thank you!

Mathieu

-- 
____________________________________________________________
Mathieu Coursolle                   mcoursolle at rogue-research.com
Rogue Research                      www.rogue-research.com 
Montréal, Québec, Canada

Code:

	const int N = 512;

	
	vtkImageData* data = vtkImageData::New();
	data->SetDimensions(N, N, 1);
	data->AllocateScalars();
	
	typedef double T;
	data->SetScalarTypeToDouble();
	
	data->SetNumberOfScalarComponents(1);
	data->SetSpacing(1, 1, 1);
	data->SetOrigin(0, 0, 0);
	T* ptr = (T*)data->GetScalarPointer();
	for(int j = 0; j < N; j++)
	{
	  for(int i = 0; i < N; i++)
	  {
	      ptr[N * j + i] = 0;
	      if ((j > N/3) && (j < 2*N/3))
			ptr[N * j + i] = N;
		  if ((i > N/3) && (i < 2*N/3))
			ptr[N * j + i] = N;
	  }
	}
	
	vtkImageSobel2D* sobel = vtkImageSobel2D::New();
	sobel->SetInput(data);
	sobel->ReleaseDataFlagOff();
	
	vtkImageViewer* viewer = vtkImageViewer::New();
	viewer->SetInputConnection(sobel->GetOutputPort());
	//viewer->SetInput(data);
	viewer->SetColorWindow(N);
	viewer->SetColorLevel(N/2.0);
	
	viewer->Render();


>On 7/6/07 12:51 PM, Mathieu Malaterre said:
>
>>My guess is that the DICOM lib was not able to do the Big/Little
>>endian check properly. Can you display correctly the image ?
>
>Hi Mathieu,
>
>Thanks for your reply.  I suspect you are correct, as it seems to be
>failing only on PPC Macs.  I searched the bug database and there is a
>(fixed) bug (2053) about TestSobel2D that was also due to endianness
problems.
>
>The image does not display correctly.  On my machine, it looks just
like this:
><http://www.vtk.org/Testing/Sites/midworld.kitware/DarwinG5-c++-cocoa/
>20070705-0300-Nightly/Results/__Imaging_Testing_Tcl_TestSobel2D-image.html>
>
>It doesn't look byte swapped though; but there could still be a swapping
>problem elsewhere.
>
>Thanks,
>
>-- 
>____________________________________________________________
>Sean McBride, B. Eng                 sean at rogue-research.com
>Rogue Research                        www.rogue-research.com 
>Mac Software Developer              Montréal, Québec, Canada
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at vtk.org
>http://www.vtk.org/mailman/listinfo/vtk-developers
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sobel_Intel_Double.png
Type: image/png
Size: 2075 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070709/0a36b745/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sobel_Intel_Int.png
Type: image/png
Size: 1712 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070709/0a36b745/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sobel_Input.png
Type: image/png
Size: 2375 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070709/0a36b745/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sobel_PPC_Int.png
Type: image/png
Size: 1730 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070709/0a36b745/attachment-0007.png>


More information about the vtk-developers mailing list