Search using SQL queries

Top  Previous  Next

Once you have opened a new workspace, you can start searching your processed images in the tags table.

 

search_03

 

 

DICOM Search uses the SQLite SQL syntax, and is very easy to use.  You will only need to access the tags table to perform your search.

 

You write SQL commands to search for tags, as detailed below.  DICOM Search also supports a simplified manner of searching, described here.

 

To start off with, try retrieving all the images stored in the tags database.  You do this by first entering the following SQL command in the SQL area:

 

SELECT * FROM tags

 

 

sql_04

 

and click on the Execute query button.

 

sql_05

 

DICOM Search will run the query and return details of all the images in the tags database for the selected library,

 

sql_06

 

 

There will be a lot of columns returned if the images we have processed contain a lot of DICOM tags.  Thus, we usually only return the columns we are interested to view the values.  To do that, you specify the columns you want to view in the query.

 

In the previous example, we returned all the columns when we entered

 

SELECT * FROM tags

 

If instead of the wildcard character (*) we entered

 

SELECT ds_filename, ds_thumbnail, [00080016], [00080018] FROM tags

 

DICOM Search then only returns the 4 columns we named.

 

sql_08

 

 

There are 3 types of columns in the tags table, one is the file metadata (file name, size, thumbnail, etc), another is the key values, and the third type is all the stored DICOM tags.  Please refer here for more details on the various columns in the tags table.

 

DICOM Search provides an easy way to find the tag values.  When your cursor is in the query window:

 

sql_09

 

 

and you press the F2 key, the Tags and Fields window is displayed.

 

sql_10

 

 

In this window, you can what each of the tag values represent.  You can filter the list by entering part of the tag description in the Filter area e.g.

 

sql11

 

 

We can see that modality is represented by the value [00080060].  If we want to return this value in our search results, we add that value ([00080060]) in the SELECT list of columns e.g.

 

SELECT ds_thumbnail, ds_filename, [00080060] FROM tags

 

 

sql_12

 

 

To search for images with a specific modality, we use that column in our WHERE clause e.g.

 

SELECT ds_thumbnail, ds_filename FROM tags WHERE [00080060] = 'MR'

 

 

sql_14