Page MenuHomePhabricator

[Py] UC1.3 - Selected image can be manipulated with simpleITK and added to data storage
Open, NormalPublic

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".

Event Timeline

floca triaged this task as Normal priority.Nov 16 2023, 4:29 PM
floca renamed this task from [Py] UC3 - Selected image can be manipulated with simpleITK and added to data storage to [Py] UC1.3 - Selected image can be manipulated with simpleITK and added to data storage.Mar 7 2024, 11:16 AM