I forgot to add, I am on Ubuntu 14.10, mitk 2014.10, qt 4.8.
Thanks!
On 28 Apr 2015 1:09 pm, "Gomez, Alberto" <alberto.go...@kcl.ac.uk> wrote:
Dear all,
I am trying to display a stream of images that I have access to at a
certain frame rate. For simplicity, let's assume they are 2D images,
they all have the same size/extent etc and only the actual pixel data
changes.
I have been looking at the US module, and particularly at
UltrasoundSupport.cpp, Where they do the following:
void UltrasoundSupport::DisplayImage()
{
//Update device
m_Device->Modified();
m_Device->Update();
//Only update the view if the image is shown
if(m_Controls.m_ShowImageStream->isChecked())
{
//Update data node
mitk::Image::Pointer curOutput = m_Device->GetOutput();
m_Node->SetData(curOutput);
// if the geometry changed: reinitialize the ultrasound image
if((m_OldGeometry.IsNotNull()) &&
(curOutput->GetGeometry() != NULL) &&
(!mitk::Equal(m_OldGeometry.GetPointer(),curOutput->GetGeometry(),0.0001,false))
)
{
mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
if ( (renderWindow != NULL) &&
(curOutput->GetTimeGeometry()->IsValid()) &&
(m_Controls.m_ShowImageStream->isChecked()) )
{
renderWindow->GetRenderingManager()->InitializeViews(
curOutput->GetGeometry(),
mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
renderWindow->GetRenderingManager()->RequestUpdateAll();
}
m_CurrentImageWidth = curOutput->GetDimension(0);
m_CurrentImageHeight = curOutput->GetDimension(1);
m_OldGeometry =
dynamic_cast<mitk::SlicedGeometry3D*>(curOutput->GetGeometry());
}
//if not: only update the view
else
{
this->RequestRenderWindowUpdate();
}
}
I am basically doing the same thing, with just minor differences due to
my data structure:
void StreamingView::ImagingHandler(LayerObject::Pointer tlo){
DNLDataHandler::Pointer dataHandler = DNLDataHandler::Pointer(new
DNLDataHandler());
std::vector< vtkSmartPointer<vtkImageData> > imageData;
{
imageData = dataHandler->createImage(tlo);
}
if (!imageData.size()){
return;
}
this->m_FrameCounter++;
/// Add the data to the viewer
{
/// Option 1: attempt to get data from my RT source
mitk::Image::Pointer mitkImage = mitk::Image::New();
mitkImage->Initialize(imageData[0]);
mitkImage->SetVolume(imageData[0]->GetScalarPointer());
this->m_Node->SetData(mitkImage);
/// Option 2: generate a random image
// mitk::Image::Pointer dummyImage =
mitk::ImageGenerator::GenerateRandomImage<float>(100, 100, 100, 1, 1, 1,
1, 255,0);
// this->m_Node->SetData(dummyImage);
if((this->m_OldGeometry.IsNotNull()) &&
(mitkImage->GetGeometry() != NULL) &&
(!mitk::Equal(m_OldGeometry.GetPointer(),mitkImage->GetGeometry(),0.0001,false)))
{
mitk::IRenderWindowPart* renderWindow =
this->GetRenderWindowPart();
if ( (renderWindow != NULL) &&
(mitkImage->GetTimeGeometry()->IsValid()) ) // &&
(this->m_Controls.m_ShowImageStream->isChecked()) )
{
renderWindow->GetRenderingManager()->InitializeViews(
mitkImage->GetGeometry(),
mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
renderWindow->GetRenderingManager()->RequestUpdateAll();
}
this->m_OldGeometry =
dynamic_cast<mitk::SlicedGeometry3D*>(mitkImage->GetGeometry());
}
else
{ //if not: only update the view
this->RequestRenderWindowUpdate();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
}
The above function is called every time there is a new image available,
which happens roughly every 50 ms. Unfortunately when I run my plugin,
the app crashes giving the following error:
[Tue Apr 28 12:55:13 20150.573] Logfile:
xxxxxxxxxxxxxxxxxxx/data/13/mitk-0.log
[1.036] [BlueBerry] LOG: Warning: Detected recursive attempt by part
org.mitk.views.datamanager to create itself (this is probably, but not
necessarily, a bug)
[1.209] [BlueBerry] BlueBerry Workbench ready
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
Aborted (core dumped)
Now, if I add a line
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
just before this->m_Node->SetData(mitkImage);
It does not crash for a little while, shows me the images flowing
through (for some reason the coronal view does not update , although the
coronal slice in the 3D view does ) but after a few seconds, or if I
try to interact with any of the views, the app crashes with the same
error as above.
I do not think the error is related to my data source because if I
comment Option1 above and uncomment Option 2 I get the same result.
Sometimes (not always) I additionally get an extra error bit:
[1.178] [BlueBerry] BlueBerry Workbench ready
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has
not been called
[xcb] Aborting, sorry about that.
MyApp: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion
`!xcb_xlib_unknown_req_in_deq' failed.
Aborted (core dumped)
Any advice/help?
Thanks a lot!
--
Dr Alberto Gomez
Research Associate
Department of Biomedical Engineering
King's College London
020 7188 7188 ext 50871
4th North Wing
St Thomas' Hospital
SE1 7EH London, UK
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users