# Slicer-Labkey extension This package allows user to connect to a labkey server through a slicer interface. ### Cloning Since there is no `master` branch, git clone will report ```bash warning: remote HEAD refers to nonexistent ref, unable to checkout. ``` Which is just a warning. Simply move to SlicerLabkeyExtension directory and checkout the SlicerExtensionIndex branch. ### Use in Slicer To use, add path to unpackaged labkeySlicerPythonAPI/labkeySlicerPythonExtension to Additional module paths in Slicer->Edit->Application Settings->Modules submenu. You'll also need the SlicerLabkeyDICOMtools package, also available from wiscgit. Then the package will appear under LabKey. ![labkeyBrowser](labkeyBrowser/Resources/Screenshots/slicerLabkeyExtensionCaption.png) If you are interested in the code, you should look at slicerNetwork.py which implements the communication with the server and forms HTTP Labkey API commands. More details and tutorial can be found at: http://www-f9.ijs.si/~studen/blogs/posts/2017/May/31/slicerlabkey-integration/ # DICOMtools A set of tools that provide DICOM loading from a remote, labkey controlled database. Most significant difference from native Slicer DICOM libraries is that no local database is used as the files are tracked by LabKey database, and that files do not neccesarily exist on local storage. ## Loading DICOM files In particular, functions like load(self,net,path) are implemented where net referrs to the server setup (slicerNetwork instance of SlicerLabKeyPythonAPI) and path is a relative path to a remote file. Two implementations were made, - importDicom that uses pydicom. Use Connection button (blue frame) to specify connections, add path on a specified LabKey site text box (cyan), provide filter as a JSON object in a text file (gold) and a button to load the remote DICOM directory as a node (red). Multiple nodes will be created if multiple DICOM series are in the target directory. To select, use filter window and specify seriesUUID or similar tags. Minimal settings require a single field with the content `SeriesLabel` and a key which should be a valid DICOM tag name with the first letter in small case. ![importDICOM](DICOMtools/Resources/Screenshots/importDICOM.png) - loadDicom that is based on DICOMLib and Slicer embedded DCMTK tools. Using SlicerRT, the program is able to load contours from DICOM-RT files, started by pushing on the pink button. The green framed button loads mixed content of volumes and segmentations. ![loadDICOM](DICOMtools/Resources/Screenshots/loadDICOM.png) ## Uploading DICOM files In particular workflows, vtkMRMLVolumeNodes created through data manipulation must be stored remotely in DICOM format for validation in other image software tools (like review by clinicans at dedicated work-stations). `exportDicom` has a function exportNode, which uploads a named node to a DICOM directory in LabKey, using unique UUID generated from baseUUID that has to be provided by the user. Use services such as [FreeDICOM][] to generate your own unique UUID. ![exportDICOM](DICOMtools/Resources/Screenshots/exportDICOM.png) [FreeDICOM]: "https://www.medicalconnections.co.uk/FreeUID/"