# Path of data added to slicer

**URL:** <https://discourse.slicer.org/t/path-of-data-added-to-slicer/30425>\
**Category:** Development\
**Created:** [July 6, 2023, 8:09am UTC](https://discourse.slicer.org/t/path-of-data-added-to-slicer/30425 "2023-07-06T08:09:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kening\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kening_zhang/32/65641_2.png) [@Kening\_Zhang](https://discourse.slicer.org/u/Kening_Zhang)\
**Post date:** [July 6, 2023, 8:09am UTC](https://discourse.slicer.org/t/path-of-data-added-to-slicer/30425/1 "2023-07-06T08:09:41Z")

</div>

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.setReadOnly(True)
    w.setToolTip("Select input file")

def selectInputFile():
  inputFile = qt.QFileDialog.getOpenFileName(self.parent, "Select input file")
  if inputFile:
    self.inputFileSelector.setText(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:
    button.clicked.connect(selectInputFile)

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

layout = qt.QHBoxLayout()
layout.addWidget(self.inputFileSelector)
layout.addWidget(button)
layout.addWidget(executeButton)

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

```

Best wishes,  
Joshua

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [July 6, 2023, 1:21pm UTC](https://discourse.slicer.org/t/path-of-data-added-to-slicer/30425/2 "2023-07-06T13:21:29Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 6, 2023, 1:27pm UTC](https://discourse.slicer.org/t/path-of-data-added-to-slicer/30425/3 "2023-07-06T13:27:13Z")

</div>

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.

```auto
>>> slicer.util.getNode("MRHead").GetStorageNode().GetFileName()
'/private/tmp/MRHead.nrrd'

```
