Page MenuHomePhabricator

[Py] UC3 - Selected image can be manipulated with simpleITK and added to data storage
Open, Needs TriagePublic

Description

Somthing like that should be possible code and details might vary...

import mitk.plugin
import mitk.ioutil
import mitk.core

nodes = mitk.plugin.get_current_selection()
ds = mitk.core.services.get_data_storage()

for node in nodes:
  image = node.get_data()
  gaussian = sitk.SmoothingRecursiveGaussianImageFilter()
  blur_image = gaussian.Execute(image)

  newNode = mitk.core.DataNode(name = node.name + '_blurred')
  newNode.data = blured_image
  newNode.properties['coolProp'] = 'value'
  ds.add_node(newNode, parents=[node])

Result: Selected images are blured and the results are added as new child node (to the respective input node) with the same node + suffix "_blurred".