[Insight-users] Checkerboard image help wanted

J Mst gave_edgar@hotmail.com
Wed, 26 Mar 2003 10:11:31 +0000


Hi all,

and many thanks for the tcl sprict you sent Luis. It's now clear to me how 
the filter works, I made a program for the command line for simplicity. I 
dont get any compilation errors anymore, but when I try to execute the 
program with two input images (the same you used in your tcl script) it 
gives an error. So I tried to track the error witch the use of VC++ and than 
it gives a break in the checkerboard class.

It looks like the two images are different in some way. Therefore I suspect 
I have to use an additional filter to correct this. If anyone could be so 
kind to tell me what filter or what other operation I have to perform to 
correct this break I'd be very pleased.

Here is a snippet of the break which has been detected (arrow) and a snippet 
of my program.

thanks in advance

Joris

-----------------<SNIP error>---------------------------------
	// Loop through output pixels
  	for (idxZ = 0; idxZ <= maxZ; idxZ++)
    	{
--->    selectZ = (((idxZ + threadOffsetZ) / divZ) % 2) << 2;
    	for (idxY = 0; idxY <= maxY; idxY++)
     	 {
      	if (!id)
        	{
        	if (!(count%target))
          	{
          	self->UpdateProgress(count/(50.0*target));
          	}
        	count++;
-------------------<SNIP error>---------------------------------

-------------------<SNIP code>---------------------------------

//ITK include files
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"


//VTK include files
#include "vtkImageViewer.h"
#include "vtkImageCheckerboard.h"
#include "vtkRenderWindowInteractor.h"


//Start of main program
int main( int argc, char **argv)
{

	typedef itk::Image<unsigned short,2>			ImageType;
	typedef itk::ImageFileReader<ImageType>			ReaderType;
	typedef itk::ImageToVTKImageFilter<ImageType>	FilterType;



	ReaderType::Pointer reader = ReaderType::New();
	ReaderType::Pointer reader2 = ReaderType::New();

	FilterType::Pointer connector = FilterType::New();
	FilterType::Pointer connector2 = FilterType::New();

	vtkImageViewer * viewer = vtkImageViewer::New();
	vtkImageCheckerboard * checker = vtkImageCheckerboard::New();
	vtkRenderWindowInteractor * interactor = vtkRenderWindowInteractor::New();


	reader->SetFileName( argv[1] );
	connector->SetInput( reader->GetOutput() );

	reader2->SetFileName( argv[2] );
	connector2->SetInput( reader2->GetOutput() );

	checker->SetInput1( connector->GetOutput() );
	checker->SetInput2( connector2->GetOutput() );

	viewer->SetInput( checker->GetOutput() );
	viewer->Render();
	viewer->SetColorWindow( 256 );
	viewer->SetColorLevel( 128 );
	interactor->Start();

	return 0;

}
-------------------<SNIP code>---------------------------------






_________________________________________________________________
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl