# Getting DICOM file path inside OnStored / OnChange

**URL:** https://discourse.orthanc-server.org/t/getting-dicom-file-path-inside-onstored-onchange/1462
**Category:** Google Groups archive
**Created:** [April 27, 2019, 8:30am UTC](https://discourse.orthanc-server.org/t/getting-dicom-file-path-inside-onstored-onchange/1462 "2019-04-27T08:30:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Hadi\_Rezaee](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/h/6bbea6/32.png) [@Hadi\_Rezaee](https://discourse.orthanc-server.org/u/Hadi_Rezaee)
#### Post date: [April 27, 2019, 8:30am UTC](https://discourse.orthanc-server.org/t/getting-dicom-file-path-inside-onstored-onchange/1462/1 "2019-04-27T08:30:47Z")

</div>

Hello there,

So, I just started to develop Orthanc plugin 🙂  
I have configured Orthanc server to store dicom files in the file system,

In the scenario that I’m working at, I’d like to get the actual file path to the dicom files that getting received by orthanc server.  
I’ve already registered my callback functions via OrthancPluginRegisterOnStoredInstanceCallback() , OrthancPluginRegisterOnChangeCallback() methods.

Is there any REST / Function that i coud pass resourceId or instanceId to them and get the file path ?

Thanks

---

<div class="post-metadata">

### Author: ![jodogne](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/jodogne/32/1511_2.png) [@jodogne](https://discourse.orthanc-server.org/u/jodogne)
#### Post date: [April 27, 2019, 2:05pm UTC](https://discourse.orthanc-server.org/t/getting-dicom-file-path-inside-onstored-onchange/1462/2 "2019-04-27T14:05:19Z")

</div>

Hello,

Because of the presence of “storage plugins”, you can’t make the assumption that the DICOM files will always be directly accessible on the filesystem:  
[http://book.orthanc-server.com/faq/orthanc-storage.html#direct-access](http://book.orthanc-server.com/faq/orthanc-storage.html#direct-access)

You should use the “OrthancPluginGetDicomForInstance()” function of the Orthanc SDK to that end:  
[http://sdk.orthanc-server.com/group\_\_Orthanc.html#gaf10589df627087401cd7e33b52db4d0f](http://sdk.orthanc-server.com/group__Orthanc.html#gaf10589df627087401cd7e33b52db4d0f)

The REST API also has the “/instances/{id}/file” URI to retrieve the raw DICOM file:  
[http://book.orthanc-server.com/users/rest.html#downloading-images](http://book.orthanc-server.com/users/rest.html#downloading-images)

HTH,  
Sébastien-

---

<div class="post-metadata">

### Author: ![Hadi\_Rezaee](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/h/6bbea6/32.png) [@Hadi\_Rezaee](https://discourse.orthanc-server.org/u/Hadi_Rezaee)
#### Post date: [April 27, 2019, 10:22pm UTC](https://discourse.orthanc-server.org/t/getting-dicom-file-path-inside-onstored-onchange/1462/3 "2019-04-27T22:22:55Z")

</div>

Thank you Sebastien,  
So based on your description I decided to stick with design and use normal/available methods to access dicom data.

I just had another question regarding to plugin development,  
As far as Orthanc is developed in multithreaded fashion, I was wondering do i need to care about generic codes I’m going to use in my plugin library (callback functions). In another word, the callback function calls are safely handled before hand or do i need to handle them manually. For example in OnStored() callback function, that there could be so many concurrent requests from clients. Is there any mutex/lock mechanism has been developed arround the function / variables or not ? generally could you please tell me what considerations are needed while developing plugin ? 🙂

Thanks.

---

<div class="post-metadata">

### Author: ![jodogne](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/jodogne/32/1511_2.png) [@jodogne](https://discourse.orthanc-server.org/u/jodogne)
#### Post date: [July 11, 2019, 3:25pm UTC](https://discourse.orthanc-server.org/t/getting-dicom-file-path-inside-onstored-onchange/1462/4 "2019-07-11T15:25:09Z")

</div>

Hello,

Sorry for the delay.

> As far as Orthanc is developed in multithreaded fashion, I was wondering do i need to care about generic codes I’m going to use in my plugin library (callback functions). In another word, the callback function calls are safely handled before hand or do i need to handle them manually. For example in OnStored() callback function, that there could be so many concurrent requests from clients. Is there any mutex/lock mechanism has been developed arround the function / variables or not ? generally could you please tell me what considerations are needed while developing plugin ? 🙂

The plugins must be able with concurrent calls to all its callbacks, and must implement the required locking mechanism if need be.

The only exception is callbacks registered using the “OrthancPluginRegisterRestCallback()” function, that are already protected by a mutex in the Orthanc core.

HTH,  
Sébastien-
