Importing file as a Label Field
-
wrote on 8 Oct 2020, 22:46 last edited by
Hello,
Is there a way how to import file such as *.nrrd or *.nii as a Label Field via python? Such an option is possible to select when importing the file via the GUI, however I can't find a way to do it via the python interface.
Regards,
Spuky
-
wrote on 14 Sept 2021, 22:09 last edited by
Hello,
any solution on this?
Thanks,
Arianna -
wrote on 20 Sept 2021, 16:39 last edited by
Is this what you need? I can import stl file in this way.
import s4l_v1.model as model
file=model.Import('file address') -
Is this what you need? I can import stl file in this way.
import s4l_v1.model as model
file=model.Import('file address')wrote on 20 Sept 2021, 21:22 last edited by@fanruifu Thanks! Nop, these lines correspond in doing in thee GUI: import, select file, ok.
I want to reproduce: import, select file, import file as a label field (pop up window that shows up when selecting the file), ok.
I hope it is clear, thank you! -
wrote on 20 Sept 2021, 22:28 last edited by
-
wrote on 21 Sept 2021, 16:26 last edited byThis post is deleted!
-
Hi, not sure this api is already in the release version, but in the dev version there is
ImageModeling.ImportImage(filepath, as_labelfield: bool = False, tissuelist_path: str = "")
This would allow you to import as labelfield and pre-assign the tissue names and colors.
If that doesn't work, you can access the options using following strategy:
- create an importer for the file,
- inspect the options.
This is a (general) solution to Import with the options:
imp = XCoreModeling.CreateImporterFromFile(file_path) imp.Options.ImportLabelField.Value = True imp.Import(file_path)
To inspect the options, you can use the
DumpTree
method:imp.Options.DumpTree()
-
wrote on 4 Oct 2021, 13:14 last edited by
this is extremely useful! thanks a lot.
-
Hello,
Is there a way how to import file such as *.nrrd or *.nii as a Label Field via python? Such an option is possible to select when importing the file via the GUI, however I can't find a way to do it via the python interface.
Regards,
Spuky
This post is deleted! -
Bannedwrote on 12 Oct 2021, 07:14 last edited by PiersPiper 10 Dec 2021, 07:14This post is deleted!