[Insight-users] Checkerboard image help wanted

Luis Ibanez luis.ibanez@kitware.com
Wed, 26 Mar 2003 23:02:25 -0500


Hi Joris,

Your code looks ok,

I compile it and was able to reproduce the
problem that you reported.

It seems that by the time the image gets
to the checkerboard filter, it thinks it
is a 3D image, 1 slice thick, instead of
being a 2D image.

The filter tries then to do a checkerboard
in Z and fails because there is nothing to
divide.

We are looking into this. It may be a problem
int the convertion between ITK and VTK
images.


Thanks for pointing this out.


Luis


-----------------------------------


J Mst wrote:
> 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
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>