Simplified search

Top  Previous  Next

For users who are unfamiliar to SQL, DICOM Search supports a simplified SQL syntax together with the use of tag aliases.


Using tag aliases


Let's say we want to display all images for patients weighing more than 70 kg.  In standard SQL, we would write the following:


SELECT ds_thumbnail, [00101030] FROM tags WHERE [00101030] > 70


where [00101030] is the DICOM tag value for patient weight.  Using tag aliases, we can get the same results by writing this:


SELECT ds_thumbnail, weight FROM tags WHERE weight > 70


We have replaced the cryptic [00101030] tag with a more descriptive name i.e. weight.  Tag aliases allow you to define your own words to represent DICOM tags.  To define an alias, first bring up the Tags and fields window.  In the Alias column, enter the word you want to represent the tags.  In the example below, we define the alias weight to represent the [00101030] tag.




You can define tags for commonly used values however you want.  The only condition is that tags cannot contain spaces and must start with an alphabetical character e.g.





Simplified SQL


From the above, we have this SQL statement to search for images where the patient's weight is > 70 kg.


SELECT ds_thumbnail, weight FROM tags WHERE weight > 70


DICOM Search allows you to replace the above statement with this:


weight > 70


You can define multiple conditions using the tag values or tag aliases too e.g.


(sex = 'M' and weight > 70) or (sex = 'F' and weight > 50)


The values you enter form the WHERE conditions.  DICOM Search will use the default prefix as defined in the SQL shortcuts preferences when it finds that the SQL statement does not start with SELECT.





Thus, when you enter


weight > 70


DICOM Search is actually running this command:


SELECT ds_thumbnail, ds_filename, ds_keyID, [00101030] FROM tags WHERE [00101030] > 70


Notice that DICOM Search automatically adds the column you search on to the list of columns that is retrieved.  You can check the actual SQL statement that DICOM Search is using by selecting the SQL page in the results window.





Using the LIMIT option


When you want to display only the first few records that match your search criteria, you can use the LIMIT keyword, followed by the number of records you want to display.


For example, to display only the first 2 records: