[vtkusers] Crash in vtkImageViewer2 when Input is changed

itkvtk123 at gmx.net itkvtk123 at gmx.net
Wed Jan 6 10:54:22 EST 2010


Does nobody have an idea why vtkImageViewer2 crashes when the input is changed? Bug or wrong usage?

Any help strongly appreciated.

_________________________________________________________________

Original Post:


---------------------
What do I want to do:
---------------------

Display image serie "A" using vtkImageviewer2.
When the forward one frame button (vtkPlaybackWidget) is pressed, display image serie "B".


---------------------
Problem:
---------------------

When forward one frame button is pressed and intensity windowing is changed afterwards, the program crashes.
(Even if image serie "A" is EXACTLY the same as image serie "B").

The crash happens in:

itkvtkimageexportbase.cxx, line 188/189

void VTKImageExportBase::UpdateInformationCallbackFunction(void* userData)
{
  static_cast<VTKImageExportBase*>
    (userData)->UpdateInformationCallback();
}


---------------------
Call Stack:
---------------------

Test.exe!itk::VTKImageExportBase::UpdateInformationCallbackFunction(void * userData=0x0566a210)  Line 189 + 0xa bytes	C++
vtkImaging.dll!vtkImageImport::InvokeUpdateInformationCallbacks()  Line 339 + 0x17 bytes	C++
vtkImaging.dll!vtkImageImportExecutive::ProcessRequest(vtkInformation * request=0x054b5e08, vtkInformationVector * * inInfoVec=0x00000000, vtkInformationVector * outInfoVec=0x056695e8)  Line 42	C++
vtkFiltering.dll!vtkExecutive::ForwardUpstream(vtkInformation * request=0x054b5e08)  Line 647 + 0x25 bytes	C++
itkFiltering.dll!vtkDemandDrivenPipeline::ProcessRequest(vtkInformation * request=0x054b5e08, vtkInformationVector * * inInfoVec=0x054ae150, vtkInformationVector * outInfoVec=0x054ae870)  Line 224 + 0x16 bytes	C++
vtkFiltering.dll!vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation * request=0x054b5e08, vtkInformationVector * * inInfoVec=0x054ae150, vtkInformationVector * outInfoVec=0x054ae870)  Line 209	C++
vtkFiltering.dll!vtkDemandDrivenPipeline::UpdateInformation()  Line 412 + 0x28 bytes	C++
vtkFiltering.dll!vtkDataObject::UpdateInformation()  Line 1043 + 0x12 bytes	C++
vtkFiltering.dll!vtkImageData::UpdateInformation()  Line 1187	C++
vtkRendering.dll!vtkImageActor::GetDisplayBounds()  Line 280 + 0x1e bytes	C++
vtkRendering.dll!vtkImageActor::GetBounds()  Line 357 + 0x8 bytes	C++
vtkRendering.dll!vtkFrustumCoverageCuller::Cull(vtkRenderer * ren=0x054b1508, vtkProp * * propList=0x0566e638, int & listLength=2, int & initialized=0)  Line 95 + 0x12 bytes	C++
vtkRendering.dll!vtkRenderer::AllocateTime()  Line 547 + 0x2b bytes	C++
vtkRendering.dll!vtkRenderer::Render()  Line 327	C++
vtkRendering.dll!vtkRendererCollection::Render()  Line 52 + 0x12 bytes	C++
vtkRendering.dll!vtkRenderWindow::DoStereoRender()  Line 711	C++
vtkRendering.dll!vtkRenderWindow::DoFDRender()  Line 677 + 0x12 bytes	C++
vtkRendering.dll!vtkRenderWindow::DoAARender()  Line 564 + 0x12 bytes	C++
vtkRendering.dll!vtkRenderWindow::Render()  Line 377 + 0x12 bytes	C++
vtkRendering.dll!vtkImageViewer2::Render()  Line 689 + 0x18 bytes	C++
vtkRendering.dll!vtkImageViewer2Callback::Execute(vtkObject * caller=0x054cb958, unsigned long event=32, void * __formal=0x054cb958)  Line 566 + 0x15 bytes	C++
vtkCommon.dll!vtkSubjectHelper::InvokeEvent(unsigned long event=32, void * callData=0x054cb958, vtkObject * self=0x054cb958)  Line 602 + 0x1f bytes	C++
vtkCommon.dll!vtkObject::InvokeEvent(unsigned long event=32, void * callData=0x054cb958)  Line 770 + 0x17 bytes	C++
vtkRendering.dll!vtkInteractorStyleImage::WindowLevel()  Line 264 + 0x11 bytes	C++
vtkRendering.dll!vtkInteractorStyleImage::OnMouseMove()  Line 96 + 0x12 bytes	C++
...


---------------------
Code:
---------------------


//////////////////////////////////////////////////////////////////////////

#include "Types.h"
#include "vtkImageViewer2.h"
#include "IO/ImageIO.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "Conversion.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkPlaybackWidget.h"
#include "vtkPlaybackRepresentation.h"

//////////////////////////////////////////////////////////////////////////

//Playbackrepresentation that loads new serie in viewer when forward one
//frame button is pressed
class MyPlayRep : public vtkPlaybackRepresentation
{
public:
	static MyPlayRep* New();
	virtual void ForwardOneFrame();
};

//////////////////////////////////////////////////////////////////////////

//Singleton GUI class with vtkImageViewer2 instance
class G
{
public:
	static G* GetInstance();
	void SetInput(Image3DType::Pointer serie);

private:
	vtkSmartPointer<vtkImageViewer2> m_viewer;
	vtkSmartPointer<vtkRenderWindowInteractor> m_iren;

	G();
	G(const G& cc);
};

//////////////////////////////////////////////////////////////////////////

//GUI implementation

G* G::GetInstance()
{
	static G instance;
	return &instance;
}

void G::SetInput(Image3DType::Pointer serie)
{
	Converter3DType::Pointer conv = Converter3DType::New();
	conv->SetInput(serie);
	conv->Update();
	m_viewer->SetInput(conv->GetOutput());
	m_viewer->Modified();
}

G::G()
{
	m_viewer = vtkSmartPointer<vtkImageViewer2>::New();

	m_iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
	m_viewer->SetupInteractor(m_iren);

	Image3DType::Pointer serie = ImageIO::loadSerieDicom("C:/serieA.dcm");
	Converter3DType::Pointer conv = Converter3DType::New();
	conv->SetInput(serie);
	conv->Update();
	m_viewer->SetInput(conv->GetOutput());

	vtkSmartPointer<vtkPlaybackWidget> w = vtkSmartPointer<vtkPlaybackWidget>::New();
	vtkSmartPointer<MyPlayRep> r = vtkSmartPointer<MyPlayRep>::New();
	w->SetRepresentation(r);
	w->SetInteractor(m_iren);
	w->On();

	m_viewer->Render();
	m_iren->Start();
}

G::G(const G& cc){}

//////////////////////////////////////////////////////////////////////////

//Playback representation implementation

MyPlayRep* MyPlayRep::New()
{
	return new MyPlayRep;
}

void MyPlayRep::ForwardOneFrame()
{
	cout << "test" << endl;
	Image3DType::Pointer serie = ImageIO::loadSerieDicom("C:/serieA.dcm");
	G::GetInstance()->SetInput(serie);
}

//////////////////////////////////////////////////////////////////////////

int main()
{
	G* g = G::GetInstance();
}

//////////////////////////////////////////////////////////////////////////


Thank you very much for your comments.

itkvtk123
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the vtkusers mailing list