# Change display range of .raw file

**URL:** <https://discourse.slicer.org/t/change-display-range-of-raw-file/6320>\
**Category:** Support\
**Created:** [March 28, 2019, 6:44am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320 "2019-03-28T06:44:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [March 28, 2019, 6:44am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/1 "2019-03-28T06:44:23Z")

</div>

Operating system:  
Slicer version:  
Expected behavior:  
Actual behavior:

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [March 28, 2019, 6:49am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/2 "2019-03-28T06:49:31Z")

</div>

hello  
i have three questions and would be glad if solved:

1. i have .mhd along with .zraw volume CT data. can i change it to .raw file
2. i want to convert display range of .zraw file or .raw file from negative and positive range to all positive range from 0 to 255. is it possible using 3D slicer.
3. as i am working on lung volume data, some volumes contrast is very bad to work on. is it possible to improve it’s contrast to work on.

---

<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:** [March 28, 2019, 7:40pm UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/3 "2019-03-28T19:40:38Z")

</div>

I do not know what .zraw format is. But if you can manage to get your data in, you can use the CastScalarVolume module to change your intensity ranges from signed (-127 to 128) to unsigned (0 to 255).

Perhaps take a look at [https://github.com/lassoan/SlicerRawImageGuess](https://github.com/lassoan/SlicerRawImageGuess) to get your images into slicer.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [March 28, 2019, 9:09pm UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/4 "2019-03-28T21:09:06Z")

</div>

zraw just means the data is in a compressed format. The corresponding MHD indicates this with the header entry `CompressedData = True`. Slicer will load the volume normally.

---

<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 31, 2019, 4:32am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/5 "2019-03-31T04:32:13Z")

</div>

You can rescale intensity values in a volume by using numpy:

```auto
volumeNode = getNode('MRHead')

import numpy as np
volumeArray = slicer.util.arrayFromVolume(volumeNode)
# Scale and shift values to be in 0..255 range
scale = 255.0 / (volumeArray.max()-volumeArray.min())
offset = -volumeArray.min()
volumeArray[:] = (volumeArray+offset)*scale
# Signal that voxel data modification is completed
slicer.util.arrayFromVolumeModified(volumeNode)

```

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 6, 2019, 5:17am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/6 "2019-05-06T05:17:38Z")

</div>

sir i am trying to use the codes you mentioned but it’s giving error : Attribute Error: ‘module’ object has no attribute ‘arrayFromVolumeModified’

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 6, 2019, 5:23am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/7 "2019-05-06T05:23:04Z")

</div>

but it has done the job. you can’t imagine how thankful i am…thanks again

---

<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 6, 2019, 5:25am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/8 "2019-05-06T05:25:49Z")

</div>

> [@anitakh1](#):
>
> Attribute Error: ‘module’ object has no attribute ‘arrayFromVolumeModified’

Use more recent Slicer version, at least the latest stable (currently Slicer-4.10.1).

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 6, 2019, 12:02pm UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/9 "2019-05-06T12:02:52Z")

</div>

sir i installed Slicer 4.10.1 but airway related modules are not there.

---

<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 6, 2019, 1:23pm UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/10 "2019-05-06T13:23:13Z")

</div>

Please report this issue to Chest Imaging Platform developers, hopefully they can address this issue soon.

@raul

---

<div class="post-metadata">

**Author:** ![technobrigade](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/technobrigade/32/3644_2.png) [@technobrigade](https://discourse.slicer.org/u/technobrigade)\
**Post date:** [May 7, 2019, 5:25am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/11 "2019-05-07T05:25:12Z")

</div>

Use the CastScalarVolume module to change intensity ranges.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 7, 2019, 7:05am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/12 "2019-05-07T07:05:13Z")

</div>

thanks for reply. one more thing sir. how to make the figure i enclosed?

 ![airway_slice](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/9/9938ff32403ad8dd0a9a8c0e25e18d7151b46026.png)

---

<div class="post-metadata">

**Author:** ![textilemarket](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/textilemarket/32/3646_2.png) [@textilemarket](https://discourse.slicer.org/u/textilemarket)\
**Post date:** [May 7, 2019, 8:48am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/13 "2019-05-07T08:48:12Z")

</div>

CastScalarVolume module will help change intensity ranges.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 7, 2019, 10:45am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/14 "2019-05-07T10:45:02Z")

</div>

one more thing. can you tell me the way to evaluate number of branches in each tree division from my airway segmented result. true results are as shown in pic.

 ![airway_generations](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/1/614e09253ea7cc2124448dff1494ec30ce9024bb.png)

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 18, 2019, 8:20am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/15 "2019-05-18T08:20:31Z")

</div>

sir, i am ready with some work on airway segmentation and 3D airway segmented results but i am not able to evaluate my work in terms of number of branches detected, airway length measurement and total false positives. can someone help me in this? i can pay also for that. pl help

---

<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 18, 2019, 5:10pm UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/16 "2019-05-18T17:10:24Z")

</div>

If people will not contact you through the forum here then you may ask [Slicer Commercial Partners](https://www.slicer.org/wiki/CommercialUse#Commercial_Partners) if they can help and provide a cost estimation.

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 19, 2019, 1:32am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/17 "2019-05-19T01:32:21Z")

</div>

thanks. will contact them

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 22, 2019, 5:47am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/18 "2019-05-22T05:47:17Z")

</div>

dear sir,  
your rescale intensity code worked very well on my most of the CT volumes but i am having problem with the volume i am enclosing. m getting error  
“D:/3Dslicer/Slicer 4.10.1/bin/…/bin/Python/slicer/slicerqt.py:1: RuntimeWarning: overflow encountered in short\_scalars import logging”  
can you help.  
oops, can’t upload as it’s raw file. sir that volume is available in Exact09 challenge website under testing data (Case24). pl see sir if you can help. i am confused on type of CT data.  
thanks a lot sir

---

<div class="post-metadata">

**Author:** ![anitakh1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anitakh1/32/3350_2.png) [@anitakh1](https://discourse.slicer.org/u/anitakh1)\
**Post date:** [May 23, 2019, 9:59am UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/19 "2019-05-23T09:59:23Z")

</div>

sir,  
i contacted slicer commerial partners. they don’t do such work. can we mark different branches of segmented airways with different colour dots in 3D slicer and some way to measure distance between the dots. this way number of airway branches and airway lengths can be calculated.

---

<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 23, 2019, 2:03pm UTC](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320/20 "2019-05-23T14:03:47Z")

</div>

> [@anitakh1](#):
>
> can we mark different branches of segmented airways with different colour dots in 3D slicer and some way to measure distance between the dots. this way number of airway branches and airway lengths can be calculated.

Yes, sure you can do that. In most recent Slicer preview (nightly) versions you can use markups curves to define and get length of entire branch at once. You can compute distance between control points very easily (Euclidean distance, computed from point coordinates). To get started, see [Slicer programming tutorials](https://www.slicer.org/wiki/Documentation/Nightly/Training#Tutorials_for_software_developers).

> [@anitakh1](#):
>
> can’t upload as it’s raw file

Upload to onedrive/dropbox/gdrive and just post the link here.

[Next page](https://discourse.slicer.org/t/change-display-range-of-raw-file/6320.md?page=2)
