Path of data added to slicer

Dear developer,
I only find the command about the path of files of DICOM, how can I find the path of data added to slicer, by the way, I also want to know the command of loaded the generated anatomical tracts into the Slicer.
Here is my code,

# Input file selector
with It(qt.QLineEdit()) as w:
    self.inputFileSelector = w
    w.setToolTip("Select input file")

def selectInputFile():
  inputFile = qt.QFileDialog.getOpenFileName(self.parent, "Select input file")
  if inputFile:

def executeTractography():
  storageNode = node.GetStorageNode()
  if storageNode is not None: # loaded via drag-drop
    self.inputFileSelector = storageNode.GetFullNameFromFileName()
with It(qt.QPushButton("Browse")) as button:

with It(qt.QPushButton("Execute")) as executeButton:

layout = qt.QHBoxLayout()

parametersFormLayout.addRow("Input File:", layout)

Best wishes,

slicer.mrmlScene.GetRootDirectory() # all nodes are saved relative to this path # write-able folder, you can use this to store any temporary data # Slicer core binary folder # Slicer extensions folder
slicer.modules.sampledata.path # path of a scripted module (in this example: Sample Data module)
1 Like

If the data was loaded from disk or saved to disk it will typically have a storage node. From there you can get the path.

>>> slicer.util.getNode("MRHead").GetStorageNode().GetFileName()
1 Like