# Saving volume properties

**URL:** https://discourse.slicer.org/t/saving-volume-properties/36475
**Category:** Support
**Created:** [May 29, 2024, 6:50pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475 "2024-05-29T18:50:13Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 29, 2024, 6:50pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/1 "2024-05-29T18:50:13Z")

</div>

I’m having what I’m sure is a newbie problem. I’m working with a 3D view of a dcm file. In Volume Rendering I optimize the Display and Advanced parameters to achieve my desired result. I then save the project as a mrb file. After closing the scene and reopening the file the Volume Rendering settings that I had adjusted are not preserved. What do I need to do to retain these settings?

Thanks,

Stuart

---

<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: [May 29, 2024, 7:16pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/3 "2024-05-29T19:16:55Z")

</div>

Volume rendering settings should be saved in the .mrb file and restored when you load the scene. Please report what version of slicer you are using and exactly what steps you take. See if you can reproduce the issue using data from the SampleData module. Maybe there are some advanced parameters that aren’t be saved correctly and it would help if you identified which ones.

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 29, 2024, 9:32pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/4 "2024-05-29T21:32:02Z")

</div>

Thank you both for causing me to look into this issue a little more deeply.

I’m using Slicer 5.6.2. My project involves working with a CT file that has been segmented. When I open this project with the segmentation display turned off and I go to Volume Rendering the 3D CT display has a red highlight. Both the Scalar Opacity and Scalar Color Mapping includes a red band. This is my core problem. I wish to delete this red band permanently. When I select “Synchronized with Volumes” module my 3D rendering is reverts to gray scale only. However, after saving this revised version as a mrb file and then reload this revised project, both the Scalar Opacity and Scalar Color Mapping still include a red band. Otherwise, all numerical values for Threshold, Opacity and in Advanced are identical in both versions.

I don’t know where this red zone I’m my project comes from given that I’m working with CT images but I would like to remove it permanently. Thanks for your help.

---

<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: [May 29, 2024, 11:51pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/5 "2024-05-29T23:51:08Z")

</div>

I think we have to see the mrb file to understand what’s going on. Can you share that? Or maybe provide a screenshot of the red band.

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 30, 2024, 3:02am UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/6 "2024-05-30T03:02:28Z")

</div>

Here’s a screenshot showing the red band:

 ![Screenshot 2024-05-29 at 8.21.29 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/3/5392ec6d479ec93d8b63c8f93abaf3bd71156473.jpeg)

The history is this:

1. Open the segmented mrb file
2. Open Data and turn off segmentation
3. Open Volume Rendering and see the attached image
4. Check and uncheck Synchronize with Volumes module to convert to gray scale image
5. Adjust Threshold, Opacity and Advanced to suit taste
6. Save modified project as mrb file
7. Open the newly saved file and see the attached with red band

Where does the red band come from? How to remove it permanently?

I tried to attach mrb file but was unsuccessful - wrong authorized file extension. How do I upload a mrb file?

Thanks

---

<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: [May 30, 2024, 3:01pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/7 "2024-05-30T15:01:47Z")

</div>

> [@Stuart](#):
>
> How do I upload a mrb file?

You can post it somewhere on the cloud (e.g., dropbox) and then share the public link. Discourse only supports attaching images and video.

Try this:  
Go to inputs, and choose to create a new volume property. Then click on (and then off) Synchronize with Volumes module. This should give a basic grayscale ramp, which i think is what you are looking for.

---

<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: [May 30, 2024, 3:09pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/8 "2024-05-30T15:09:51Z")

</div>

If you share the scene file then we can tell where the red control point in the scalar color mapping function comes from and suggest how to fix it permanently.

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 30, 2024, 3:10pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/9 "2024-05-30T15:10:13Z")

</div>

I’ve learned that if I delete the volume property and add a new one the red cast disappears. However, when I save the project as a mrb file and then reopen it the recast has returned. I hope this observation is useful in understanding what is amiss. Thanks.

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 30, 2024, 3:24pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/10 "2024-05-30T15:24:16Z")

</div>

Here’s the Dropbox link: [Dropbox](https://www.dropbox.com/scl/fi/wsu02odzgauws40ihhcso/02-90Cu-32-LR-Reversed.mrb?rlkey=x7aj40khq3iczs0q8tje40xeu&st=foq0yaqn&dl=0)

---

<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: [May 30, 2024, 4:40pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/11 "2024-05-30T16:40:01Z")

</div>

You have a very unusual dataset. The intensities are between 0 and 0.148 and saved as double precision.  
I don’t think the volume rendering widgets are designed to handle such low range. The typical intensity values for CT data have 12 bit range (e.g., 0-4096).

I did those changes (Simple Filter-\>Rescale Intensity Filter to scale the image 0-4905. Then run the Cast Image Module and choose the option to set unsigned short). everything works fine, with a regular grayscale ramp that persists.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/d/0d9146b02ecb33132a43ec77d3c427bb52b89d9e.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: [May 30, 2024, 6:36pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/12 "2024-05-30T18:36:38Z")

</div>

I’ve found the root cause of the unexpected red color appearing. The line length in the .vp file reader had an arbitrary maximum line length (1024 characters), therefore when many control points were in the color transfer function then the list of points got truncated. Since truncation occurred in the middle of an entry, the red component was successfully read out, but the green and blue were missing and set to 0.

I’ll push a fix today or tomorrow.

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 30, 2024, 7:48pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/13 "2024-05-30T19:48:56Z")

</div>

I followed the steps you outlined and got exactly the same result as in your image including the two control points and nice ramp and same appearance of the 3D image. I then saved the file with a new name, closed the scene, and loaded the new file. This is the result I obtained:

 ![Screenshot 2024-05-30 at 1.35.08 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/7/c74f653c97be164ca9f6e37f445893ac6480cf0d.jpeg)

Why isn’t the scalar mapping information retained and why is the 3D image different?

I can readjust the mapping and reconstruct the result but why isn’t this information retained in volume properties?

Thanks

---

<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: [May 30, 2024, 9:44pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/14 "2024-05-30T21:44:57Z")

</div>

> [@Stuart](#):
>
> Why isn’t the scalar mapping information retained and why is the 3D image different?

perhaps it is related to the issue @lassoan posted above. When the push is fixed, please try with the latest preview version and see if the issue persists.

---

<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: [May 31, 2024, 1:11pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/15 "2024-05-31T13:11:21Z")

</div>

The fix for the truncated color transfer function is submitted and currently under review:

> <https://github.com/Slicer/Slicer/pull/7772>
>
> Color transfer function line in .vp files can be several thousands character lon…g when there are many control points but the reader had a hardcoded limit at 1024 bytes. Fixed by switching to use an API that does not limit line length.
> 
> As a preventive action, all other line parsing where a hardcoded line length limit was set is replaced.
> 
> Fixes the issue reported at https://discourse.slicer.org/t/saving-volume-properties/36475/12

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 31, 2024, 5:03pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/16 "2024-05-31T17:03:36Z")

</div>

Now I’m working with Slicer 5.7.0-2024-05-30, revision 32881.

I’ve opened my project and the red band issue is complete absent. Hurray.

I then created a new volume property, clicked the Synchronize with Volume module on and off, and then adjusted the Threshold and Opacity. This revised project was saved with a new number and then reopened. Unfortunately the adjusted volume properties were not retained. They could easily be reset but were still not retained when repeating this process.

---

<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: [May 31, 2024, 8:31pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/17 "2024-05-31T20:31:42Z")

</div>

I don’t think today’s preview build has those fixed. Changes are merged less than an hour ago. So the earliest it will be incorporated will be tomorrow’s preview build (make sure the revision number has increased before downloading, if build doesn’t complete tonight due to any reason, it will still the same version as today.).

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [May 31, 2024, 9:35pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/18 "2024-05-31T21:35:42Z")

</div>

Well that’s interesting isn’t it?

---

<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: [June 1, 2024, 12:26pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/19 "2024-06-01T12:26:07Z")

</div>

I’m not sure what you mean. We fully understand what happened any why: only the first 1024 bytes of the color transfer function was read from the .vp file, which caused incomplete loading and potentially color corruption of the last read color point.

The fix was integrated yesterday and is now available in the Slicer Preview Release today (2024-06-01). Yesterday’s release did not contain the fix.

---

<div class="post-metadata">

### Author: ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://discourse.slicer.org/u/Stuart)
#### Post date: [June 2, 2024, 5:17pm UTC](https://discourse.slicer.org/t/saving-volume-properties/36475/20 "2024-06-02T17:17:18Z")

</div>

Thanks Andras,

This morning I downloaded the new release (5.7.0-2024-06-01 r32886 / eceb683) and all my difficulties disappeared.

You deserve a raise!
