# Object size

**URL:** https://discourse.vtk.org/t/object-size/5308
**Category:** Support
**Created:** [March 3, 2021, 10:34pm UTC](https://discourse.vtk.org/t/object-size/5308 "2021-03-03T22:34:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mauro](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/45deac/32.png) [@mauro](https://discourse.vtk.org/u/mauro)
#### Post date: [March 3, 2021, 10:34pm UTC](https://discourse.vtk.org/t/object-size/5308/1 "2021-03-03T22:34:15Z")

</div>

Dear all,

I’m reading a volume from a file (.vtk) using vtkGenericDataObjectReader, in python:

```
reader = vtk.vtkGenericDataObjectReader()
reader.SetFileName( "file.vtk" )

```

It reads the file with no issues. However, I’m struggling to retrieve the size in pixel of the volume (x, y, z). Is it possible? If positive, how?

Many thanks,  
Mauro

---

<div class="post-metadata">

### Author: ![mauro](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/45deac/32.png) [@mauro](https://discourse.vtk.org/u/mauro)
#### Post date: [March 4, 2021, 9:51am UTC](https://discourse.vtk.org/t/object-size/5308/2 "2021-03-04T09:51:48Z")

</div>

solved, by using vtkStructuredPointsReader, still a mystery how to do it within vtkGenericDataObjectReader - tho. Here my solution, for future reference:

```
    reader2 = vtkStructuredPointsReader()
    reader2.SetFileName("file.vtk")
    reader2.ReadAllVectorsOn()
    reader2.ReadAllScalarsOn()
    reader2.Update()
    data2 = reader2.GetOutput()
    dim = data2.GetDimensions()
    print (dim)

```

cheers,  
Mauro
