# Add Data for VTK volume fails

**URL:** <https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572>\
**Category:** Support\
**Created:** [December 1, 2017, 12:14pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572 "2017-12-01T12:14:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbc/32/992_2.png) [@JBC](https://discourse.slicer.org/u/JBC)\
**Post date:** [December 1, 2017, 12:14pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/1 "2017-12-01T12:14:26Z")

</div>

Dears,

I have a VTI volume image which I use in Paraview and would like to use it in Slicer. Therefore, I exported it in Paraview to legacy VTK format. However, loading the file via ‘Add Data’ in Slicer fails.

The error log gives me the two messages listed below. Until now I could not identify the cause for this.  
Would be great if there is somebody who can help.

I am new to slicer and would like to use it due to its potentially better support for manual segmentation of 3D Volumes than provided by Paraview.

Thanks!

1.)  
Premature EOF in reading a line

Algorithm vtkITKArchetypeDiffusionTensorImageReaderFile(0x1300ab560) returned failure for request: vtkInformation (0x628000a74340)  
Debug: Off  
Modified Time: 1196867  
Reference Count: 1  
Registered Events: (none)  
Request: REQUEST\_INFORMATION  
ALGORITHM\_AFTER\_FORWARD: 1  
FORWARD\_DIRECTION: 0

Premature EOF in reading a line

Algorithm vtkITKArchetypeImageSeriesVectorReaderSeries(0x1300a5850) returned failure for request: vtkInformation (0x628000a66100)  
Debug: Off  
Modified Time: 1198427  
Reference Count: 1  
Registered Events: (none)  
Request: REQUEST\_INFORMATION  
ALGORITHM\_AFTER\_FORWARD: 1  
FORWARD\_DIRECTION: 0

Premature EOF in reading a line

Algorithm vtkITKArchetypeImageSeriesVectorReaderFile(0x1300a7ec0) returned failure for request: vtkInformation (0x628000a6d840)  
Debug: Off  
Modified Time: 1198530  
Reference Count: 1  
Registered Events: (none)  
Request: REQUEST\_INFORMATION  
ALGORITHM\_AFTER\_FORWARD: 1  
FORWARD\_DIRECTION: 0

2.)  
Premature EOF in reading a line

Algorithm vtkITKArchetypeImageSeriesScalarReader(0x13d734620) returned failure for request: vtkInformation (0x600000e7abc0)  
Debug: Off  
Modified Time: 1199340  
Reference Count: 1  
Registered Events: (none)  
Request: REQUEST\_INFORMATION  
ALGORITHM\_AFTER\_FORWARD: 1  
FORWARD\_DIRECTION: 0

ReadData: This is not a nrrd file

ReadData: Cannot read file as a volume of type DiffusionTensorVolume[fullName = /Volumes/LaCie\_RAID\_0/Schutzwald/Scans\_Export/Herrschaft\_48347/regeneration\_cluster/hs48347\_nopole\_005-to-010m\_q1\_res01\_te1e-4\_ryx05\_rz3\_syx1-35\_sz11\_ss3-5\_sw\_NCUT\_CONSTRAINED\_MRF\_NOBGC\_Mngroups\_clusters.vtk]  
Number of files listed in the node = 0.  
File reader says it was able to read 1 files.  
File reader used the archetype file name of /Volumes/LaCie\_RAID\_0/Schutzwald/Scans\_Export/Herrschaft\_48347/regeneration\_cluster/hs48347\_nopole\_005-to-010m\_q1\_res01\_te1e-4\_ryx05\_rz3\_syx1-35\_sz11\_ss3-5\_sw\_NCUT\_CONSTRAINED\_MRF\_NOBGC\_Mngroups\_clusters.vtk [reader 0th file name = /Volumes/LaCie\_RAID\_0/Schutzwald/Scans\_Export/Herrschaft\_48347/regeneration\_cluster/hs48347\_nopole\_005-to-010m\_q1\_res01\_te1e-4\_ryx05\_rz3\_syx1-35\_sz11\_ss3-5\_sw\_NCUT\_CONSTRAINED\_MRF\_NOBGC\_Mngroups\_clusters.vtk]  
FileFormatError

ReadData: This is not a nrrd file

ReadData: Failed to instantiate a file reader

ReadData: Cannot read file as a volume of type Volume[fullName = /Volumes/LaCie\_RAID\_0/Schutzwald/Scans\_Export/Herrschaft\_48347/regeneration\_cluster/hs48347\_nopole\_005-to-010m\_q1\_res01\_te1e-4\_ryx05\_rz3\_syx1-35\_sz11\_ss3-5\_sw\_NCUT\_CONSTRAINED\_MRF\_NOBGC\_Mngroups\_clusters.vtk]  
Number of files listed in the node = 0.  
File reader says it was able to read 1 files.  
File reader used the archetype file name of /Volumes/LaCie\_RAID\_0/Schutzwald/Scans\_Export/Herrschaft\_48347/regeneration\_cluster/hs48347\_nopole\_005-to-010m\_q1\_res01\_te1e-4\_ryx05\_rz3\_syx1-35\_sz11\_ss3-5\_sw\_NCUT\_CONSTRAINED\_MRF\_NOBGC\_Mngroups\_clusters.vtk [reader 0th file name = /Volumes/LaCie\_RAID\_0/Schutzwald/Scans\_Export/Herrschaft\_48347/regeneration\_cluster/hs48347\_nopole\_005-to-010m\_q1\_res01\_te1e-4\_ryx05\_rz3\_syx1-35\_sz11\_ss3-5\_sw\_NCUT\_CONSTRAINED\_MRF\_NOBGC\_Mngroups\_clusters.vtk]  
FileFormatError

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [December 1, 2017, 1:05pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/2 "2017-12-01T13:05:13Z")

</div>

I’m guessing the exported file contains more than just a single scalar volume (slicer is trying to extract a tensor from it). Probably in paraview you can find filters to export only the scalar you want to edit that would load directly in Slicer. Or you could write a python script in Slicer to load the file and extract the part you want (same VTK filters would work in either program). If you want to post an example file we could make suggestions.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 1, 2017, 2:50pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/3 "2017-12-01T14:50:32Z")

</div>

For saving images from Paraview, use either “Legacy VTK files(_.vtk)" or "Meta Image Files(_.mhd)”. Note: If you choose .vtk format then when you open the volume in Slicer, choose “Volume” in the Description column in “Add data…” dialog.

What do you need to do in Paraview? Paraview is great for mesh manipulation but rather limited for images: it ignores image orientation, cannot load compressed MetaIO image, NRRD, many other common image formats, rendering capabilities are very basic, no image editing, virtually no image filtering capabilities, reslicing is extremely slow, no orthogonal slice view, etc.

---

<div class="post-metadata">

**Author:** ![JBC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbc/32/992_2.png) [@JBC](https://discourse.slicer.org/u/JBC)\
**Post date:** [December 12, 2017, 11:32am UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/4 "2017-12-12T11:32:38Z")

</div>

Thank you for your suggestions. The vtk file has only one data array of type double.  
It is a bit curious, but sometimes, after repeated trials to open the file, it is listed in the data module panel. However, I can not visualize it or do anything with it. I am using Slicer 4.8 on a Mac.  
I would like to upload a sample, but unfortunately only standard image formats (jpg, etc.) are allowed. Therefore, I copy the ASCII version of the sample vtk file below. At least in Paraview one can load it and export it as binary if required.

```auto
# vtk DataFile Version 4.2
vtk output
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 11 11 11
SPACING 1 1 1
ORIGIN 0 0 0
CELL_DATA 1000
FIELD FieldData 1
image 1 1000 double
1 1 0 1 1 1 1 1 1 
1 1 1 0 0 1 1 1 1 
1 1 0 0 0 0 0 1 1 
1 1 1 0 0 0 0 0 0 
0 0 1 1 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
1 0 0 0 0 0 0 0 0 
0 1 0 0 0 1 1 1 1 
1 1 0 0 0 0 1 1 1 
1 1 1 0 0 0 0 0 1 
1 1 1 1 0 0 0 0 0 
0 1 1 1 1 0 0 0 0 
0 0 1 1 0 0 0 0 0 
0 0 0 1 1 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 1 0 0 0 1 1 1 
1 1 1 0 0 0 0 1 1 
1 1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 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 
0 
METADATA
INFORMATION 0

```

---

<div class="post-metadata">

**Author:** ![JBC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbc/32/992_2.png) [@JBC](https://discourse.slicer.org/u/JBC)\
**Post date:** [December 12, 2017, 12:07pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/5 "2017-12-12T12:07:05Z")

</div>

Thanks for your help. I did everything as you described, except of the mhd format, which does not work to export from vti or vtk in Paraview. I wanted to test slicer for manually delineating single objects from a volumetric image. Paraview has some tools for voxel selection, but they are relatively basic and do not work well for accuate delineation of details.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 12, 2017, 1:56pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/6 "2017-12-12T13:56:05Z")

</div>

Have you found a solution for all your questions or there are still things that don’t work yet?

To share a large file, upload the file to dropbox and copy-paste the link into your post.

---

<div class="post-metadata">

**Author:** ![JBC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbc/32/992_2.png) [@JBC](https://discourse.slicer.org/u/JBC)\
**Post date:** [December 13, 2017, 12:16pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/7 "2017-12-13T12:16:47Z")

</div>

No, unfortunately still unsolved. The small ascii vtk file in my respond to Steve Pieper should work for demonstrating the problem.  
Note: A ‘number sign’ or ‘hash’ should be added as first character to the first line ‘vtk DataFile Version 4.2’ (/# vtk DataFile Version 4.2), which probably is just a comment for the vtk reader (I tried to ‘escape’ the symbol, but it seemed that it did not work).

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [December 13, 2017, 8:26pm UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/8 "2017-12-13T20:26:36Z")

</div>

I think that dataset can only be read by `vtkStructuredPointsReader`, which it looks like Slicer does not use (from a quick grep).

---

<div class="post-metadata">

**Author:** ![JBC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbc/32/992_2.png) [@JBC](https://discourse.slicer.org/u/JBC)\
**Post date:** [December 14, 2017, 9:43am UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/9 "2017-12-14T09:43:23Z")

</div>

‘Structured Points’ is what Paraview exports me as legacy VTK after reading a VTI file. I do not have a choice. However, I discovered that after some filtering (thresholding) Paraview exports me an ‘unstrucered grid’ as legacy VTK from the same original file.  
Still, it cannot be read by Slicer.

Below I copy the ascii version of this type of VTK files (an even smaller subset as posted before):

```
# vtk DataFile Version 4.2
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 64 float
0 0 0 1 0 0 0 1 0 
1 1 0 0 0 1 1 0 1 
0 1 1 1 1 1 2 0 0 
2 1 0 2 0 1 2 1 1 
3 0 0 3 1 0 3 0 1 
3 1 1 0 2 0 1 2 0 
0 2 1 1 2 1 2 2 0 
2 2 1 3 2 0 3 2 1 
0 3 0 1 3 0 0 3 1 
1 3 1 2 3 0 2 3 1 
3 3 0 3 3 1 0 0 2 
1 0 2 0 1 2 1 1 2 
2 0 2 2 1 2 3 0 2 
3 1 2 0 2 2 1 2 2 
2 2 2 3 2 2 0 3 2 
1 3 2 2 3 2 3 3 2 
0 0 3 1 0 3 0 1 3 
1 1 3 2 0 3 2 1 3 
3 0 3 3 1 3 0 2 3 
1 2 3 2 2 3 3 2 3 
0 3 3 1 3 3 2 3 3 
3 3 3 
METADATA
INFORMATION 1
NAME L2_NORM_RANGE LOCATION vtkDataArray
DATA 2 0 5.19615 

CELLS 27 243
8 0 1 2 3 4 5 6 7 
8 1 8 3 9 5 10 7 11 
8 8 12 9 13 10 14 11 15 
8 2 3 16 17 6 7 18 19 
8 3 9 17 20 7 11 19 21 
8 9 13 20 22 11 15 21 23 
8 16 17 24 25 18 19 26 27 
8 17 20 25 28 19 21 27 29 
8 20 22 28 30 21 23 29 31 
8 4 5 6 7 32 33 34 35 
8 5 10 7 11 33 36 35 37 
8 10 14 11 15 36 38 37 39 
8 6 7 18 19 34 35 40 41 
8 7 11 19 21 35 37 41 42 
8 11 15 21 23 37 39 42 43 
8 18 19 26 27 40 41 44 45 
8 19 21 27 29 41 42 45 46 
8 21 23 29 31 42 43 46 47 
8 32 33 34 35 48 49 50 51 
8 33 36 35 37 49 52 51 53 
8 36 38 37 39 52 54 53 55 
8 34 35 40 41 50 51 56 57 
8 35 37 41 42 51 53 57 58 
8 37 39 42 43 53 55 58 59 
8 40 41 44 45 56 57 60 61 
8 41 42 45 46 57 58 61 62 
8 42 43 46 47 58 59 62 63 

CELL_TYPES 27
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11

CELL_DATA 27
FIELD FieldData 1
image 1 27 double
1 1 0 1 1 0 0 0 0 
1 0 0 0 0 0 0 0 0 
1 0 0 0 0 0 0 0 0 

METADATA
INFORMATION 0
```

---

<div class="post-metadata">

**Author:** ![JBC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbc/32/992_2.png) [@JBC](https://discourse.slicer.org/u/JBC)\
**Post date:** [December 14, 2017, 9:54am UTC](https://discourse.slicer.org/t/add-data-for-vtk-volume-fails/1572/10 "2017-12-14T09:54:27Z")

</div>

Ok, I’ve just detected, that the ‘unstructered grid’ type of my VTK file can be read as Model, but still not as Volume. I guess, this is not what I need, since I do not have access to the image array values. in Slicer software documentation legacy VTK is listed as supported file format for Volumes.
