![]() |
Is there anyway to read in vtk files and determine the value of each pixel?
Cause I need to figure out how to do that. :)
|
Re: Is there anyway to read in vtk files and determine the value of each pixel?
Yep. You learn what the format is, what the parts of it mean, and read the file accordingly. For instance, there is usually a small piece which describes the type of format, and its version. Then there's a header that describes the data. For instance, is it color or grayscale. How many bytes per pixel? Is there a color table or are the pixels raw color data. Stuff like that.
Personally, I study the format. Then I define some structures or classes that conform to the various pieces of the format (magic number, version, header, etc.). Then I write the code to read the file into those structures, then I refer to the information in those structures when reading the raw data. |
Re: Is there anyway to read in vtk files and determine the value of each pixel?
I don't understand what you are saying. This is the header of the files:
# vtk DataFile Version 3.0 VTK File Generated by Insight Segmentation and Registration Toolkit (ITK) BINARY DATASET STRUCTURED_POINTS DIMENSIONS 41 41 41 SPACING 1.0000000000000000e+00 1.0000000000000000e+00 1.0000000000000000e+00 ORIGIN 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 POINT_DATA 68921 SCALARS scalars unsigned_char 1 LOOKUP_TABLE default What I want to do is be able to read in the vtk file and then read in the value of each pixel. Starting with the pixel located at 0 0 0, all the way to the pixel located at 41 41 41. |
Re: Is there anyway to read in vtk files and determine the value of each pixel?
What part of that don't you understand? Here is an example definition from a VTK spec:
Quote:
|
| All times are GMT +5.5. The time now is 15:10. |