Search code examples
c++imagevisual-studiomitk

how to access image property list and manipulate in MITK


I am developing a plugin for MITK, which is a tookit for medical imaging. I want to access the full path of image that is loaded in the data manager.

There are properties of images like name, opacity, path etc.

I searched MITK documentation but I could not find any proper information related to that.

Can you please help me?


Solution

  • If you want to see the 'path' in the UI, you can use the Properties plugin, available in the MITK Workbench and in your own app if you decided to include it.

    If you want to access the content of the 'path' property in the code, then you need a mitk::DataNode in the current scope, because properties are usually related to node.

    std::string path;
    node->GetStringProperty("path", path);
    

    Note that this won't give you the full path though. For some reason, MITK decided to remove the extension in this property, thus giving something like D://Data/brain instead of the D://Data/brain.nii.gz that I wanted.

    AFAIK, there's currently no 100% safe way to get the real full path in MITK, but one could easily search on the file system using path + ".*" and hoping that it returns only one result :)