InsightSoftwareConsortium / itkwidgets

An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.

Home Page:https://itkwidgets.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Difficulty Comparing Label Map and Intensity Image

tbirdso opened this issue · comments

Overview

I am seeing issues comparing a label image to an intensity image in correspondence.

Details

A few things seem to be happening:

  1. Positional arguments: difficult to tell which image should be listed first, how order affects underlying logic
  2. Initial view: One image initially appears in the scene, but is replaced rather than overlaid when the second image loads
  3. Comparison tabs: Both "Fixed" and "Moving" titles shown in UI, but no tabs initially appear to indicate that multiple channels are present
  4. Transfer function range: min and max transfer function scales are locked at range of second positional image argument, if values in first image lie out side the range the control points cannot be updated to include those values
  5. Double clicking a comparison option such as cyan-magneta overlay makes channel tabs 1 and 2 appear, but clicking on the second tab makes UI overlay disappear and produces the following console error:
bootstrapUIMachineOptions.js.es.js:5383 TypeError: Cannot read properties of undefined (reading '1')
    at ColorRangeInput (bootstrapUIMachineOptions.js.es.js:16481:37)
    at Ch (bootstrapUIMachineOptions.js.es.js:4256:7)
    at li (bootstrapUIMachineOptions.js.es.js:4719:7)
    at ck (bootstrapUIMachineOptions.js.es.js:6822:93)
    at bk (bootstrapUIMachineOptions.js.es.js:6301:12)
    at ak (bootstrapUIMachineOptions.js.es.js:6294:5)
    at Tj (bootstrapUIMachineOptions.js.es.js:6277:7)
    at Lj (bootstrapUIMachineOptions.js.es.js:6045:24)
    at bootstrapUIMachineOptions.js.es.js:3507:17
    at exports.unstable_runWithPriority (bootstrapUIMachineOptions.js.es.js:1209:14)

Minimum Reproducible Example

The following creates one "intensity" image with values on the range [127, 255] and one "label" image with values [0,1] and attempts to compare them in the scene:

arr = np.zeros([25,25,25], dtype=np.uint8)
arr[0:5,0:5,0:5] = 1
tmp_label_image = itk.image_view_from_array(arr)

arr2 = np.random.rand(25,25,25) * 128 + 127
tmp_intensity_image = itk.image_view_from_array(arr2.astype(np.float32))

itkwidgets.compare_images(tmp_label_image, tmp_intensity_image)

Versions

itkwidgets==1.0a33
itk==v5.3.0
Python 3.8, JupyterLab 3.0.9 (CodeOcean environment)
Google Chrome browser

cc @PaulHax