[Insight-users] Checkerboard image help wanted

Luis Ibanez luis.ibanez@kitware.com
Tue, 25 Mar 2003 12:03:11 -0500


This is a multi-part message in MIME format.
--------------000108090308010106000902
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi Joris,


The attached Tcl script is what we used to generate
the Checkerboard images in the SoftwareGuide.
(you will see that in the Registration chapter).


Note that the two inputs to the checkerboard image
are set with

SetInput1()
SetInput2()
http://www.vtk.org/doc/nightly/html/classvtkImageCheckerboard.html
http://www.vtk.org/doc/nightly/html/classvtkImageTwoInputFilter.html

I assume you are taking two ITK images, passing each one
through a itkImageToVTKImage adaptor, and then connecting each
one of the adaptor outputs, to one of the inputs in the Checkerboard
filter.....   is that what you are doing ?

The ImageToVTKImage adaptor encapsulates a itkVTKImageExport
and a vtkImageImport filter, so using the adaptor is just equivalent
to using the vtkImageImport filter.

--

The attached script will hopefully clarigy the use of this filter...



Regards,


    Luis



-------------------------------------------------------------------
J Mst wrote:
> Hi all,
> 
> The question is maybe a bit off-topic but I hope anyone will be so kind 
> to answer it.
> 
> 
> I was messing around with the checkerboard class in VTK, but as you can 
> suspect, it didnt worked the way I wanted. I wanted to 'easily' load two 
> different images and than display a checkerboard image of these two with 
> the use of VTK.
> 
> First I tried the 'ItkImageToVTKImageFilter' in order to get the input 
> for the 'VTKImageCheckerboard'. This didnt work.
> 
> Then I tried the 'itkVTKImageExport' and the 'VTKImageImport' both to 
> connect the ITK/VTK pipeline (make sense to me). But This also didnt work.
> 
> Finally, I tried the 'VTKImageReader'. Now it had to work because I get 
> the image directly into VTK. But you'll guess, it didnt.
> 
> It'll probable be a silly error but I really like to get some help on 
> this. I suspect I don't give the checkerboard class the right input 
> because VC++ says:
> 
> ----------------------------------------------
> Compiling resources...
> Compiling...
> StdAfx.cpp
> test.cpp
> testDlg.cpp
> C:\Joris\Project\test\testDlg.cpp(230) : error C2660: 'GetOutput' : 
> function does not take 0 parameters
> C:\Joris\Project\test\testDlg.cpp(234) : error C2109: subscript requires 
> array or pointer type
> C:\Joris\Project\test\testDlg.cpp(234) : error C2064: term does not 
> evaluate to a function
> Error executing cl.exe.
> 
> ALL_BUILD - 3 error(s), 0 warning(s)
> ----------------------------------------
> 
> I'd really like to know how this 'simple' task has to be done. An 
> example or just some usefull hints would be very appreciated.
> 
> Joris
> 
> 
> 
> _________________________________________________________________
> 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
> 



--------------000108090308010106000902
Content-Type: text/plain;
 name="CompareImages.tcl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="CompareImages.tcl"

package require vtk

vtkPNGReader reader1
  reader1 SetFileName "PNG/BrainT1SliceBorder20.png"
  
vtkPNGReader reader2
  reader2 SetFileName "PNG/BrainProtonDensitySliceShifted13x17y.png"

vtkImageCheckerboard checkers
  checkers SetInput 0 [reader1 GetOutput]
  checkers SetInput 1 [reader2 GetOutput]
  checkers SetNumberOfDivisions 4 4 1

vtkPNGWriter writer
  writer  SetInput [ checkers GetOutput ]

  writer SetFileName "PNG/ImageRegistration2CheckboardBefore.png"
  writer  Write
  
  reader2 SetFileName "PNG/ImageRegistration2Output.png"
  writer  SetFileName "PNG/ImageRegistration2CheckboardAfter.png"
  writer  Write

vtkImageViewer viewer
  viewer SetInput [ checkers GetOutput ]

  viewer SetColorWindow  256
  viewer SetColorLevel   128

  viewer Render

--------------000108090308010106000902--