# DIMENSIONS field of the VTK legacy format

**URL:** https://discourse.vtk.org/t/dimensions-field-of-the-vtk-legacy-format/1810
**Category:** Support
**Created:** [September 24, 2019, 9:22am UTC](https://discourse.vtk.org/t/dimensions-field-of-the-vtk-legacy-format/1810 "2019-09-24T09:22:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![danielc](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danielc/32/915_2.png) [@danielc](https://discourse.vtk.org/u/danielc)
#### Post date: [September 24, 2019, 9:22am UTC](https://discourse.vtk.org/t/dimensions-field-of-the-vtk-legacy-format/1810/1 "2019-09-24T09:22:59Z")

</div>

Hello,

I hope this is the correct forum to ask a question about the VTK legacy file format. I have this application (not mine) that produces VTK legacy files, and it does something funky with the `DIMENSIONS` line and I was hoping someone could tell me whether it’s allowed by [the spec](https://lorensen.github.io/VTKExamples/site/VTKFileFormats/). For context, here is a sample file:

```auto
# vtk DataFile Version 2.0
PRIMITIVE vars at time= 1.202073e-01, level= 0, domain= 0
BINARY
DATASET STRUCTURED_POINTS
DIMENSIONS 1025 1 1
ORIGIN -5.000000e-01 -5.000000e-01 -5.000000e-01 
SPACING 9.765625e-04 1.000000e+00 1.000000e+00 
CELL_DATA 1024 
SCALARS density float
LOOKUP_TABLE default
... <binary data goes here> ...

```

In this example, the data is actually a 1D array with 1024 entries. The application encodes the dimensionality of the array by adding 1 to all the dimentions that it considers “real” dimensions, so any dimension of length 1 is supposed to be ignored. For example:

```nohighlight
1D array with 16 cells --> DIMENSIONS 17 1 1
2D array with 16x15 cells --> DIMENSIONS 17 16 1
3D array with 16x15x14 cells --> DIMENSIONS 17 16 15

```

You see how that works? What that means is that if you multiply the dimensions as written in the file you do not get the value in **CELL\_DATA**. In the first example that I wrote above we have:

```auto
DIMENSIONS 1025 1 1
... 
CELL_DATA 1024 

```

So my question is: Is this legal? Is this a valid VTK legacy file? I tried to find a detailed specification for the VTK legacy file format but I couldn’t. So I would appreciate some clarification.

Thanks!

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [September 24, 2019, 12:44pm UTC](https://discourse.vtk.org/t/dimensions-field-of-the-vtk-legacy-format/1810/2 "2019-09-24T12:44:35Z")

</div>

Hi,  
The DIMENSIONS specifies the number of points. This is why they are one more than the number of cells.

Dan

---

<div class="post-metadata">

### Author: ![danielc](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danielc/32/915_2.png) [@danielc](https://discourse.vtk.org/u/danielc)
#### Post date: [September 24, 2019, 5:02pm UTC](https://discourse.vtk.org/t/dimensions-field-of-the-vtk-legacy-format/1810/3 "2019-09-24T17:02:30Z")

</div>

Hi Dan,

What is the difference between a point and a cell? From your reply, I’m imagining that points must correspond to the edges of a grid cell, but in that case what does it mean for there to be just 1 point? The program I have here uses “1 point” to denote that an dimension does not exist.

Is there a place where I can read a more detailed spec of the legacy format? Or maybe find a few examples?

Thanks!

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [September 24, 2019, 6:48pm UTC](https://discourse.vtk.org/t/dimensions-field-of-the-vtk-legacy-format/1810/4 "2019-09-24T18:48:28Z")

</div>

Hi Daniel,  
Take a look at VTK Text book section 5.3

[https://lorensen.github.io/VTKExamples/site/VTKBook/05Chapter5/](https://lorensen.github.io/VTKExamples/site/VTKBook/05Chapter5/)

The points correspond to edge intersections, cells which can be 2D or 3D cover the space between the points - they are used for interpolation = finding out values at places other than points.

If one of the dimensions is one means that the model is flat in that direction.

Dan
