[vtkusers] Reading image with vtkMetaImageReader from different thread
Christian Mol
christianmol at gmail.com
Fri Sep 30 09:45:18 EDT 2016
Hi,
Currently I am writing a small webservice (using the Casablanca rest
library from Microsoft) that should output a png image from a metaimage I
have stored on disk.
Problem seems to be however that when I call the folllowing code in the
thread that handles the web request, it just hangs on the Update call
vtkSmartPointer<vtkMetaImageReader> reader =
vtkSmartPointer<vtkMetaImageReader>::New();
reader->SetFileName("image.mhd");
reader->SetFileLowerLeft(true);
reader->Update();
When I run this code in the main thread of my application it does read the
image, but when I put the code in the handler for the http requests (I
guess different thread) it hangs.
When stepping through the code it seems that it hangs at the fflush(NULL)
line in MetaObject::ReadStream.
vtkmetaio-7.0.dll!vtkmetaio::MetaObject::ReadStream(int _nDims,
std::basic_ifstream<char,std::char_traits<char> > * _stream) Line 319 C++
vtkmetaio-7.0.dll!vtkmetaio::MetaImage::ReadStream(int _nDims,
std::basic_ifstream<char,std::char_traits<char> > * _stream, bool
_readElements, void * _buffer) Line 1283 C++
vtkmetaio-7.0.dll!vtkmetaio::MetaImage::Read(const char * _headerName,
bool _readElements, void * _buffer) Line 1252 C++
vtkIOImage-7.0.dll!vtkMetaImageReader::ExecuteInformation() Line 82 C++
vtkIOImage-7.0.dll!vtkMetaImageReader::RequestInformation(vtkInformation
* __formal, vtkInformationVector * * __formal, vtkInformationVector *
outputVector) Line 252 C++
vtkCommonExecutionModel-7.0.dll!vtkImageAlgorithm::ProcessRequest(vtkInformation
* request, vtkInformationVector * * inputVector, vtkInformationVector *
outputVector) Line 109 C++
vtkCommonExecutionModel-7.0.dll!vtkExecutive::CallAlgorithm(vtkInformation
* request, int direction, vtkInformationVector * * inInfo,
vtkInformationVector * outInfo) Line 775 C++
vtkCommonExecutionModel-7.0.dll!vtkDemandDrivenPipeline::ExecuteInformation(vtkInformation
* request, vtkInformationVector * * inInfoVec, vtkInformationVector *
outInfoVec) Line 481 C++
vtkCommonExecutionModel-7.0.dll!vtkStreamingDemandDrivenPipeline::ExecuteInformation(vtkInformation
* request, vtkInformationVector * * inInfoVec, vtkInformationVector *
outInfoVec) Line 412 C++
vtkCommonExecutionModel-7.0.dll!vtkDemandDrivenPipeline::ProcessRequest(vtkInformation
* request, vtkInformationVector * * inInfoVec, vtkInformationVector *
outInfoVec) Line 237 C++
vtkCommonExecutionModel-7.0.dll!vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation
* request, vtkInformationVector * * inInfoVec, vtkInformationVector *
outInfoVec) Line 336 C++
vtkCommonExecutionModel-7.0.dll!vtkDemandDrivenPipeline::UpdateInformation()
Line 406 C++
vtkCommonExecutionModel-7.0.dll!vtkStreamingDemandDrivenPipeline::Update(int
port) Line 347 C++
vtkCommonExecutionModel-7.0.dll!vtkAlgorithm::Update(int port) Line 1456
C++
vtkCommonExecutionModel-7.0.dll!vtkAlgorithm::Update() Line 1450 C++
Service_d.exe!Service::images(web::http::http_request message) Line 501
C++
Does anyone have any hints as to why this would happen? Would replacing
fflush(NULL) with fflush(_stream) help at that specific location?
Kind regards,
Christian Mol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160930/9efa42c5/attachment.html>
More information about the vtkusers
mailing list