[vtkusers] Reading an XDMF file using the vtkXdmf3Reader class fails even though the function CanReadFile() returns true.
Magnus Elden
magnus_elden at hotmail.com
Fri Jul 22 12:11:22 EDT 2016
I am trying to modify the SmartVolumeMapper example to read an .xdmf file,
but I get an error when calling the Update() function.
1 1'Value' not in itemProperties in XdmfTime::populateItem
The error above is all I have been able to get out of the function. What am
I doing wrong? The .xdmf, .h5 and .hdf5 are all in the same folder and the
"1 1" output before the error shows that it can be read. I am using
VisualStudio 2015 and no other libraries than VTK. I am building everything
as x64 Release. The error occurs between '1' and '2'. (Please refer to the
printf() calls below.)
This is a minimal program that causes the error:
#include <vtkVersion.h>
#include <vtkSmartPointer.h>
#include <vtkSphere.h>
#include <vtkSampleFunction.h>
#include <vtkSmartVolumeMapper.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkVolumeProperty.h>
#include <vtkCamera.h>
#include <vtkImageShiftScale.h>
#include <vtkImageData.h>
#include <vtkPointData.h>
#include <vtkDataArray.h>
#include <vtkXMLImageDataReader.h>
#include <vtkXdmf3Reader.h>
static void CreateImageData(vtkImageData* im);
int main(int argc, char *argv[])
{
vtkSmartPointer<vtkXdmf3Reader> reader =
vtkSmartPointer<vtkXdmf3Reader>::New();
reader->SetFileName("C:/Users/NoobsDeSroobs/Downloads/testVolume.xdmf");
printf("1 %d" ,
reader->CanReadFile("C:/Users/NoobsDeSroobs/Downloads/testVolume.xdmf"));
reader->Update();
printf("2");
int numArrays = reader->GetNumberOfPointArrays();
printf("3");
for (int i = 0; i < numArrays; i++) {
printf("Name of index %d is: %s", i,
reader->GetPointArrayName(i));
printf("2");
}
return 0;
}
Finally, I noticed that the standard way of copying the read data to the
vtkImageData is by doing a shallow copy of the output of the reader, but
imageData->ShallowCopy(reader->GetOutput()) does not compile as GetOutput()
does not exist. I have a feeling this might have something to do with the
fact that this is a 4D file and not a standard 3D file.
If possible a working example would be great to have.
Finally, some functions like Update() and Read() are not listed in the
documentation: http://www.vtk.org/doc/nightly/html/classvtkXdmf3Reader.html
Just a heads up.
Thank you so much for your help.
Yours,
Magnus Elden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160722/5502195e/attachment.html>
More information about the vtkusers
mailing list