Example C++ VolumeRendering SimpleRayCast

I have run the sample code (SimpleRayCast).
The build is successful, but SimpleRayCast.exe can not run using the command prompt.
When “SimpleRayCast ironProt.vtk” is entered on the command prompt, errors occurs and operation stops.
Operating environment, VTK-7.1.1, visual studio2012.


Could you please give more detailed error output? It is difficult for someone to help without knowing what’s wrong.

Here is an example for printing errors to the log file:

To Kenichiro Yoshimi,

Thanks for your reply.

I will attach an error screen.

After the above error screen is displayed for a few seconds, the command prompt disappears from the screen.


The error you get indicates that .exe does not find ironProt.vtk in the execution directory. Could you confirm if ironProt.vtk file is really placed in the execution directory?


Thanks for your reply.
I was able to understand the contents of the error.

May I ask you questions in Japanese if possible?

Thank you for replying the other day.

I understood the meaning of the error.
I was also able to confirm the location of the file.

The following error was displayed as a result of specifying Path and executing it.

The file format is .md5

The MD5 hash does not contain actual content but checksum in extracting the external data into actual content.

By the way, it seems likely that you can directly download the data under link:

Thank you for your reply.

I was able to understand the question.
Download and try it once.

I was able to display ironProt.vtk
Thank you for the advice.

We hope to create volume rendering of raw data (512x512x512) in the future.
Is it possible to display raw data directly?
Or do you need to convert to another extension?

You can definitely read 3D raw data (.raw/.mhd) with vtkImageReader. Here the *.mhd file is a header file called Meta Image Data file and it is easily filled with some meta information about the stored raw data.

Thank you for your reply.

I have .raw 3D data.
As a conversion method, do you use MetaImageImporter or convert with the following source code?

ObjectType = Image
NDims = 3
DimSize = 256 256 256
ElementType = MET_USHORT
HeaderSize = -1
ElementSize = 1 1 3
ElementSpacing = 1 1 1
ElementByteOrderMSB = False
ElementDataFile = image.raw

I created the mhd header manually. But at this point, you can do whatever you want.

Can you tell me how to create manually?

I had discovered the right values in the mhd header with a little trial and error. I am sorry I don’t know more straightforward approach to set up them.

It was possible to convert to .mhd.
May I tell you how to enter .mhd into VTK(Ray Cast Program)?

You need to read a mhd file by vtkMetaImageReader instead of vtkStructuredPointsReader. I hope the following example is helpful:

Thank you for reply.

It was executed using the code of MetaImageReader.
I was able to convert .raw to .mhd and display 2D images.

ImageSliceIteratorWithIndexTest.mha downloaded from the following URL can be adjusted on VTK when displayed.
However, I can not do that with the data I have.

If you know, can you tell me?