ImFusion Web SDK

useDisplayOptions2d

ts
function useDisplayOptions2d(sis: SharedImageSet): DisplayOptions2d;

Returns the reactive 2D display options for a dataset.

Subscribes to DisplayOptions2d.onChanged. The hook triggers a re-render whenever the options change.

Parameters

ParameterTypeDescription
sisSharedImageSetThe dataset whose 2D display options to observe

Returns

DisplayOptions2d

The DisplayOptions2d handle

Throws

If called outside of an ImFusionProvider

Throws

If called before the SDK has finished initializing

Example

tsx
function DisplayControls2D({ sis }: { sis: SharedImageSet }) {
  const opts = useDisplayOptions2d(sis);
  return (
    <div>
      <p>
        Window: {opts.window} / Level: {opts.level}
      </p>
      <button
        onClick={() => {
          opts.window = 400;
          opts.level = 40;
        }}
      >
        Lung preset
      </button>
    </div>
  );
}

See

useDisplayOptions3d