Example C++ VolumeRendering SimpleRayCast

(Tomonari Hayakawa ) #1

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.

(Kenichiro Yoshimi) #2

Hi,

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:
https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/FileOutputWindow/

(Tomonari Hayakawa ) #3

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.

(Kenichiro Yoshimi) #4

Hi,

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?

(Tomonari Hayakawa ) #5

Hi,

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

May I ask you questions in Japanese if possible?

(Tomonari Hayakawa ) #6

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

(Kenichiro Yoshimi) #7

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:
https://data.kitware.com/#item/588272dc8d777f4f3f3077ca

(Tomonari Hayakawa ) #8

Thank you for your reply.

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

(Tomonari Hayakawa ) #9

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?

(Kenichiro Yoshimi) #10

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.
https://itk.org/Wiki/ITK/MetaIO/Documentation

(Tomonari Hayakawa ) #11

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

(Kenichiro Yoshimi) #12

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

(Tomonari Hayakawa ) #13

Can you tell me how to create manually?

(Kenichiro Yoshimi) #14

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.

(Tomonari Hayakawa ) #15

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

(Kenichiro Yoshimi) #16

You need to read a mhd file by vtkMetaImageReader instead of vtkStructuredPointsReader. I hope the following example is helpful:
https://lorensen.github.io/VTKExamples/site/Cxx/IO/MetaImageReader/

(Tomonari Hayakawa ) #17

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?

https://data.kitware.com/#folder/5c77024e8d777f072b6c4347