# Dicom to rectilinear grid vtk

**URL:** <https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289>\
**Category:** Support\
**Tags:** dicom, vtk\
**Created:** [March 10, 2023, 8:18pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289 "2023-03-10T20:18:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fil](https://avatars.discourse-cdn.com/v4/letter/f/bc8723/32.png) [@fil](https://discourse.slicer.org/u/fil)\
**Post date:** [March 10, 2023, 8:18pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/1 "2023-03-10T20:18:59Z")

</div>

How can I create rectilinear grid .vtk file from DICOM flies, please? I used to be able to do this using slicer. Any help will be much appreciated. Thank you.

---

<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:** [March 11, 2023, 7:02am UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/2 "2023-03-11T07:02:32Z")

</div>

You can load the DICOM image and then when you save it choose the .vtk file format. You will see a warning because .vtk file format cannot store image axis directions, but the file is still saved.

---

<div class="post-metadata">

**Author:** ![fil](https://avatars.discourse-cdn.com/v4/letter/f/bc8723/32.png) [@fil](https://discourse.slicer.org/u/fil)\
**Post date:** [March 11, 2023, 12:18pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/3 "2023-03-11T12:18:54Z")

</div>

Thank you for your answer. I have tried this and is giving me structured grid vtk file not a rectilinear grid. What I need is rectilinear grid vtk file. Thank you

---

<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:** [March 11, 2023, 4:18pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/4 "2023-03-11T16:18:55Z")

</div>

VTK files are confusing because they may store many types of data. What would you actually like to save: a labelmap image, a surface mesh, or a volumetric mesh?

---

<div class="post-metadata">

**Author:** ![fil](https://avatars.discourse-cdn.com/v4/letter/f/bc8723/32.png) [@fil](https://discourse.slicer.org/u/fil)\
**Post date:** [March 11, 2023, 4:32pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/5 "2023-03-11T16:32:08Z")

</div>

They are DICOM files.

---

<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:** [March 11, 2023, 4:39pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/6 "2023-03-11T16:39:04Z")

</div>

You import DICOM files into Slicer. What would you like to then save - a grayscale image, a label image, a surface mesh, or a volumetric mesh? What software will use that file and how?

---

<div class="post-metadata">

**Author:** ![fil](https://avatars.discourse-cdn.com/v4/letter/f/bc8723/32.png) [@fil](https://discourse.slicer.org/u/fil)\
**Post date:** [March 11, 2023, 5:59pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/7 "2023-03-11T17:59:00Z")

</div>

I need a VTK rectilinear grid to use it in bonemat software. I suppose is a gray scale image as I need the gray scale.  
Thank you

---

<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:** [March 12, 2023, 8:22pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/8 "2023-03-12T20:22:52Z")

</div>

Bonemat can load the image that you saved in .vtk format.

Saving in Slicer:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/0/0021014163775d1985d8a9609b87ae60476a1cf3.png)

Saved .vtk file loaded into bonemat and displayed in OrthoSlice view:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/a/da628d47b59bb5dd7c7f63b6ca2742b0e22145c2.jpeg)

---

<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:** [March 12, 2023, 8:33pm UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/9 "2023-03-12T20:33:24Z")

</div>

By the way, it seems that [all that bonemat can do](http://www.bonemat.org/downloads/Bonemat_manual.pdf) you can already do in Slicer. For the parameter mapping from CT densities to mechanical properties you can use a few lines of Python code (or using [py\_bonemat\_abaqus](https://pypi.org/project/py_bonemat_abaqus/)). The license of bonemat is quite restrictive and you can do so much more in Slicer that I would recommend to consider using just Slicer for your workflow.

---

<div class="post-metadata">

**Author:** ![fil](https://avatars.discourse-cdn.com/v4/letter/f/bc8723/32.png) [@fil](https://discourse.slicer.org/u/fil)\
**Post date:** [March 13, 2023, 10:11am UTC](https://discourse.slicer.org/t/dicom-to-rectilinear-grid-vtk/28289/10 "2023-03-13T10:11:03Z")

</div>

I was unaware that Slicer could map material properties from CT scan data as I am unfamiliar with this software. For example, I used Slicer to create a rectilinear grid vtk file, but now it only makes a structured grid vtk file. Please direct me on how Slicer can do this. Also, is the resulting file with mapped materials compatible with Abaqus software? Also, I am not that familiar with Python code.  
In Bonemat, I can see this file, but it is not mapping anything on my mesh. The error I get is “scalar visibility: false”. I have looked to see how to fix this error, but I need help finding something.  
On the other hand, I used pybonemat for Abaqus, which looks like a better variant than Bonemat. However, I have tried with both vtk and DICOM files, and I got the following errors:  
“AttributeError: Dataset does not have attribute ‘ImagePositionPatient’.”  
“ValueError: Error reading VTK header, unrecognised format” the vtk file was created with Slicer.  
Thank you very much for your help.
