# PLY file colors not displayed

**URL:** <https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206>\
**Category:** Development\
**Tags:** extensions-manager\
**Created:** [September 27, 2018, 10:24am UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206 "2018-09-27T10:24:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [September 27, 2018, 10:24am UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/1 "2018-09-27T10:24:17Z")

</div>

I have an exported ply file that contains color information that I would like to see and be able to access from python. If I load the file I see the model but I do not see the color. I looked at the header of the file and by the looks of it the color is given per vertex. Is color supported?

[START PLY HEADER]  
ply  
format binary\_little\_endian 1.0  
comment Exported model  
element vertex 238415  
property float x  
property float y  
property float z  
property float nx  
property float ny  
property float nz  
property uchar red  
property uchar green  
property uchar blue  
element face 473991  
property list uchar int vertex\_indices  
end\_header  
[END PLY HEADER]

---

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [September 27, 2018, 12:20pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/2 "2018-09-27T12:20:49Z")

</div>

After reading this: [https://discourse.slicer.org/t/displaying-textured-3d-models/2521/9](https://discourse.slicer.org/t/displaying-textured-3d-models/2521/9)

I think colors per vertex are supported, I tried the Models module and enabled the scalars. I have set it to RGB and can select a colormap, but I get strange colors. do I need a colormap to get the colors from the model to display?

---

<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:** [September 27, 2018, 12:33pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/3 "2018-09-27T12:33:12Z")

</div>

Both vertex and cell scalars can be used for coloring. There were some fixes in color table mapping a 1-2 months ago, so make sure you use a recent nightly version.

---

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [September 28, 2018, 2:58pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/4 "2018-09-28T14:58:08Z")

</div>

Hi Andras, I just tried the nightly build version 4.9.0-2018-09-27 with no luck. Also here no colors (at least not the colors from the file )  
STR:

- I load the ply (it shows in gray)
- I open the Models module
- select the scalars tab
- set the checkbox to: visible
- select active scalar: rgb

I can play with the colortable to get some colors, but those are not the colors from the file. In MeshLab the colors seem to work fine, so the file is correct.

---

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [September 28, 2018, 4:03pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/5 "2018-09-28T16:03:05Z")

</div>

Update: I got some color of the original colors to display when I tried flipping the rgb values in the data. Not sure how it suddenly happened and I am unable to reproduce it now. Can anybody confirm that vertex colors work with the nightly build?

---

<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:** [October 1, 2018, 12:02am UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/6 "2018-10-01T00:02:20Z")

</div>

We usually use single-component scalars + a lookup-table for coloring, as it is much more flexible than burnt-in RGB values (you can threshold, recolor, etc. dynamically) . For displaying an arbitrarily textured model, we typically use .obj file format, because this is how we usually get these models.

Per-verted colored .ply files are not very common, but might be useful to display them directly, so I’ve added a new option “Direct color mapping” to colors module / display / scalars section. You can use this option to use per-vertex 3-component scalar values directly as RGB values (without mapping it through a lookup table). This feature will be available in Slicer nightly version that you download tomorrow or later.

---

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [October 2, 2018, 7:09am UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/7 "2018-10-02T07:09:44Z")

</div>

Hi Andras, Thanks for your explanation. I tested the “direct color mapping” feature you added in the nightly build and I would like to confirm that it works perfectly. Thanks for adding the feature on such short notice.

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 22, 2024, 6:29am UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/8 "2024-08-22T06:29:29Z")

</div>

> [@lassoan](#):
>
> ve added a new option “Direct color m

Dear Prof Andras

I am having trouble in displaying colours from IOS scans exported as ply or obj. The export files works well in exocad viewer or similar softwares but in 3D Slicer i cannot reproduce the colour. What needs to be done ?

 ![Screenshot 2024-08-22 115655](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/a/aa4f5b8ba6a81df61870bc70e6535a46b268a88f.png)  
 ![Screenshot 2024-08-22 115731](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/d/1df09b31225a9dc4d424af36305e153610fa8de7.jpeg)

thank you

---

<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:** [August 22, 2024, 12:16pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/9 "2024-08-22T12:16:59Z")

</div>

This can probably be fixed if you share some sample datasets.

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 22, 2024, 5:06pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/10 "2024-08-22T17:06:17Z")

</div>

Dear Steve

Please find the ply and the obj file formats of the same scan from a Intra oral scanner.

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1G3dSSzqrY1jPlVURahYv7ro4kpEWZ7f3%2Fview%3Fusp%3Ddrive_link&followup=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1G3dSSzqrY1jPlVURahYv7ro4kpEWZ7f3%2Fview%3Fusp%3Ddrive_link&ifkv=Ab5oB3qQY6oU47LhCJTZQQPHl_2cSmclL_qQe8ZXAjXe78Bgn2j0l-U6VpV5iiF6ZUHcxMXuSdWD4Q&osid=1&passive=1209600&service=wise&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S-802000182%3A1724346319818695&ddm=0)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

> **[Google Drive: Sign-in](https://accounts.google.com/v3/signin/identifier?continue=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1DLR1nahQkwX_LdVLiv9nVyiTi7aRDBKE%2Fview%3Fusp%3Ddrive_link&followup=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1DLR1nahQkwX_LdVLiv9nVyiTi7aRDBKE%2Fview%3Fusp%3Ddrive_link&ifkv=Ab5oB3ptWyHybIF2A08GZxPk04F2CUn01jp4Wzs2AapMjnxSUkaMNaQeSTucYtAlj7bWO4zjcwph&osid=1&passive=1209600&service=wise&flowName=GlifWebSignIn&flowEntry=ServiceLogin&dsh=S-1120258562%3A1724346328151081&ddm=0)**
>
> Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).

thank you for your time and effort.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [August 22, 2024, 5:35pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/11 "2024-08-22T17:35:04Z")

</div>

> [@manjula](#):
>
> cannot reproduce the colour

I don’t think you need the Normals as Active scalars. What else do you have in that drop down?

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 22, 2024, 6:04pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/12 "2024-08-22T18:04:51Z")

</div>

i tried all available options and combinations but didnt work.

---

<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:** [August 22, 2024, 8:42pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/13 "2024-08-22T20:42:26Z")

</div>

I loaded the ply file in my local build and this is what I got with no changes needed in the models module. It looks right to me.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/e/5ee1ee4d911230ac80cad19c10b8848e6771cc73.jpeg)

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 23, 2024, 1:45am UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/14 "2024-08-23T01:45:42Z")

</div>

ohh this looks great . but i dont see get this. i will share my version details as well as try the newest version and see

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 27, 2024, 6:32pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/15 "2024-08-27T18:32:56Z")

</div>

Dear Steve,

I tried with my 3D Slicer windows and Linux versions 5.7.0 2024.05.30 and ,latest windows version 2024.08.27 and unfortunately for me the no colours are shown .

What could be the issue ?

thank you

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [August 27, 2024, 6:38pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/16 "2024-08-27T18:38:59Z")

</div>

It works fine with the preview and stable versions on my Mac. Maybe you have some initialization scripts (.slicerrc.py) or other things? did you try with a vanilla install.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/7/973a6e07495b1d1451144ad926473e53a245088e.jpeg)

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 27, 2024, 7:28pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/17 "2024-08-27T19:28:49Z")

</div>

I tried with vanilla installation as well.

just to clarify I am working on the **obj** file not the ply file. ply file i get the colours in the recent release but not on the **obj** file.

---

<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:** [August 27, 2024, 7:59pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/18 "2024-08-27T19:59:36Z")

</div>

I only tried the ply file since the obj file link didn’t have the correct permissions. I just requested access to the obj version.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [August 27, 2024, 8:09pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/19 "2024-08-27T20:09:52Z")

</div>

> [@manjula](#):
>
> I am working on the **obj** file not the ply

Yeah, I obj doesn’t want to download. If you are trying obj, try with the SlicerMorph install, and when you drag it into Slicer, choose the file description from model to Textured OBJ. That might help.

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [August 28, 2024, 5:35pm UTC](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206/20 "2024-08-28T17:35:21Z")

</div>

Hi all

Just to confirm the behaviour in my computer. the obj file does not show colour. I tried importing as obj textured model and it doesnt work either. however the ply works with colors.

In the scalar tab the obj file does not show RGB option like in the ply files.  
(i have changed the privacy settings for the obj file if someone wish to try it)

 ![Screenshot 2024-08-28 173217](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/e/aead4f6779b0a1011563078d949a9054a48ce6b7.png)  
 ![Screenshot 2024-08-28 173243](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/9/b960fcb835b90e091efd7782cb2861f8e4e1c56b.png)

Thank you

[Next page](https://discourse.slicer.org/t/ply-file-colors-not-displayed/4206.md?page=2)
