Change display range of .raw file

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

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.

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 to get your images into slicer.

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.

2 Likes

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

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)
1 Like

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

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

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

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

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

@raul

Use the CastScalarVolume module to change intensity ranges.

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

CastScalarVolume module will help change intensity ranges.

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

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

If people will not contact you through the forum here then you may ask Slicer Commercial Partners if they can help and provide a cost estimation.

thanks. will contact them

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

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.

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.

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