[vtkusers] problem with the vtkcheckerboard widget

Bill Lorensen bill.lorensen at gmail.com
Wed Apr 25 19:30:30 EDT 2012


You'll have to resample one of the images. Checkerboard only works on
images with the same pixel resolution and does not respect
spacing/direction etc. The usual use-case is to compare two registered
images. In that case, the one of the images is resampled to the same
resolution as another.

On Tue, Apr 24, 2012 at 2:49 PM, Mark Roden <mmroden at gmail.com> wrote:
> Hi all,
>
> I'm trying to load two images and look at them in the checkerboard
> widget.  My problem is that the images are medical images, and also
> have different sizes.
>
> They have two different origins.  Image 1 has an origin and spacing of:
>        (0020,0032)     Image Position (Patient)        DS      3       -239\-154\1218
>        (0028,0030)     Pixel Spacing   DS      2       9.3359375e-1\9.3359375e-1
>
> and image 2 has an origin and spacing of:
>        (0020,0032)     Image Position (Patient)        DS      3       -286.585938\-201.585938\1216.500000
>        (0028,0030)     Pixel Spacing   DS      2       4.000000\4.000000
>
> The point is to be able to check the registration of these two datasets.
>
> When I try to load them using the widget example, I get the following errors:
> ERROR: In ..\..\..\VTK\Filtering\vtkStreamingDemandDrivenPipeline.cxx, line 1009
> vtkStreamingDemandDrivenPipeline (02B2D6A0): The update extent
> specified in the information for output port 0 on algorithm
> vtkTrivialProducer(02B2D0D0) is 0 511 0 511 0 0, which is outside the
> whole extent 0 143 0 143 0 212.
>
>
> ERROR: In ..\..\..\VTK\Filtering\vtkImageData.cxx, line 1530
> vtkImageData (02AE75A8): GetScalarPointer: Pixel (0, 256, 0) not in memory.
>  Current extent= (0, 143, 0, 143, 0, 212)
>
> (these errors repeat for several instances, all saying essentially the
> same thing).
>
> Once the errors are done, then the images are present, but clearly not
> respecting the pixel coordinates at all.
>
> What can I do to make the checkerboard widget (or the wipe widget)
> respect pixel spacing and the origin values of the two different
> vtkImageData I'm using?  (the follow up question will be about using
> vtkAffineWidget to adjust the registration, so if there is already a
> sample project on how to do that, that would be excellent).
>
> My code, run in Qt 4.8 on vc 2008 with 5.10.0-rc1:
>
>
>    vtkFileOutputWindow* window = vtkFileOutputWindow::New();
>    window->SetFileName("vtk_errors.txt");
>    vtkOutputWindow::SetInstance(window);
>    window->Delete();
>
>    //for now, just show the two volumes together
>    //code from page 282 of the VTK User's Manual
>    vtkImageCheckerboard* checkers = vtkImageCheckerboard::New();
>    checkers->SetInput1(theImages->getVolume(0)->getImageData());//theImages
> holds vtkImageData objects
>    checkers->SetInput2(theImages->getVolume(1)->getImageData());
>    checkers->SetNumberOfDivisions(10,6,1);
>
>    vtkImageActor *checkerboardActor = vtkImageActor::New();
>    checkerboardActor->SetInput(checkers->GetOutput());
>
>    vtkCheckerboardRepresentation* rep =
>            vtkCheckerboardRepresentation::New();
>    rep->SetCheckerboard(checkers);
>    rep->SetImageActor(checkerboardActor);
>
>    vtkCheckerboardWidget *checkerboardWidget =
>            vtkCheckerboardWidget::New();
>    checkerboardWidget->SetRepresentation(rep);
>
>
>    vtkSmartPointer<vtkRenderer> ren1 =
>      vtkSmartPointer<vtkRenderer>::New();
>    vtkSmartPointer<vtkRenderWindow> renWin =
>      vtkSmartPointer<vtkRenderWindow>::New();
>    renWin->AddRenderer(ren1);
>
>
>    vtkSmartPointer<vtkRenderWindowInteractor> iren =
>      vtkSmartPointer<vtkRenderWindowInteractor>::New();
>    iren->SetRenderWindow(renWin);
>
>    checkerboardWidget->SetInteractor(iren);
>
>    ren1->AddActor(checkerboardActor);
>    ren1->SetBackground(0.1, 0.2, 0.4);
>    renWin->SetSize(300, 300);
>
>    // render the image
>    //
>    iren->Initialize();
>    renWin->Render();
>    checkerboardWidget->On();
>    iren->Start();
>
> Thanks!
> Mark
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



-- 
Unpaid intern in BillsBasement at noware dot com



More information about the vtkusers mailing list