CONTACT US

568-3-53 (3rd Floor) Kompleks Mutiara 3 1/2 Mile, Jalan Ipoh 51200 Kuala Lumpur, Malaysia 6012-9714904 support@yohz.com https://www.yohz.com https://www.dicomsearch.com https://yohzapps.yohz.com
Copyright © 2005 - 2021 Yohz Software, a division of Yohz Ventures Sdn Bhd. ALL RIGHTS RESERVED. All trademarks or registered trademarks are property of their respective owners

2.5

Advanced searches

In the previous topics, we have seen how to write your search query to retrieve the values you want using the SELECT list, and how to use the WHERE condition to filter the images. In this topic, we will explore how to form more complex search conditions. We will be using simplified queries in our examples, using the default tag aliases. The simplest search condition is a single condition e.g. modality = 'US' To add more conditions, use the AND and OR operators. For e.g. modality = 'US' AND weight > 60 will search for all ultrasound images where the patient weight is 60 or more. If instead we entered: modality = 'US' OR weight > 60 then all ultrasound images or images whose patient weight is 60 or more is returned. You can combine multiple AND and OR operators e.g. modality = 'US' OR modality = 'MR' AND weight > 60 This query will run, but it isn’t very clear exactly what we are searching for. In these cases, using brackets to group the search conditions makes things clearer e.g. modality = 'US' OR (modality = 'MR' AND weight > 60) means search for all ultrasound images, or MR images whose patient weight is greater than 60.

2.5.1

Why does the tag type matter?

In the Tags and Fields window, you can see the ‘type’ of each DICOM element. The tag type determines the kind of comparisons you can make with the tag value.

text type

The text type is the most common type. You can search for equality values e.g. modality = 'US' or inequality values e.g. modality <> 'US' This means return all images whose modality value is not ultrasound. You can search for a set using the IN operator e.g. modality IN ('US', 'MR', 'ES') which is a shorter way of writing modality = 'US' OR modality = 'MR' OR modality = 'ES' You can also search for partial strings using the LIKE operator. To search for images with a specific prefix, use the wildcard character (%) as a suffix e.g. name LIKE 'patient%' This returns all images where the name tag value starts with patient. To search for images with a specific suffix, use the wildcard character as a prefix e.g. name LIKE '%patient' This returns all images where the name tag value ends with patient. To search for images containing a specific word anywhere in its value, use the wildcard character both as a prefix and suffix e.g. name LIKE '%patient%'

number type

You can use the common mathematical operators for numeric tag types i.e. >, <, =, >=, <=, <>. E.g. weight > 60 AND weight <= 80 returns images where the patient large is larger than 60 and less than or equal to 80.

date and time values

DICOM stores date values using the format yyyymmdd. For e.g. 15 March 2021 will be stored as 20210315 in DICOM Search. Time values are stored using the format hhmmss.frac. For e.g. 08:15:05.000 will be stored as 081505.0000. To filter on date and time values, you need to treat the values as numbers. For e.g. to search for images created in April 2020, you need to use the following search criteria: studydate >= 20200401 AND studydate < 20200501 We’re seen how we index our DICOM images and how to search for those images using SQL queries and simplified queries. Now let’s see how we can use the search results.

Section summary

Tag types determine the type of search conditions we can apply to our search.

Related help file topics

Common SQL queries

CONTACT US

568-3-53 (3rd Floor) Kompleks Mutiara 3 1/2 Mile, Jalan Ipoh 51200 Kuala Lumpur, Malaysia 6012-9714904 support@yohz.com https://www.yohz.com https://www.dicomsearch.com https://yohzapps.yohz.com
Copyright © 2005 - 2020 Yohz Software, a division of Yohz Ventures Sdn Bhd. ALL RIGHTS RESERVED. All trademarks or registered trademarks are property of their respective owners

2.5

Advanced searches

In the previous topics, we have seen how to write your search query to retrieve the values you want using the SELECT list, and how to use the WHERE condition to filter the images. In this topic, we will explore how to form more complex search conditions. We will be using simplified queries in our examples, using the default tag aliases. The simplest search condition is a single condition e.g. modality = 'US' To add more conditions, use the AND and OR operators. For e.g. modality = 'US' AND weight > 60 will search for all ultrasound images where the patient weight is 60 or more. If instead we entered: modality = 'US' OR weight > 60 then all ultrasound images or images whose patient weight is 60 or more is returned. You can combine multiple AND and OR operators e.g. modality = 'US' OR modality = 'MR' AND weight > 60 This query will run, but it isn’t very clear exactly what we are searching for. In these cases, using brackets to group the search conditions makes things clearer e.g. modality = 'US' OR (modality = 'MR' AND weight > 60) means search for all ultrasound images, or MR images whose patient weight is greater than 60.

2.5.1

Why does the tag type matter?

In the Tags and Fields window, you can see the ‘type’ of each DICOM element. The tag type determines the kind of comparisons you can make with the tag value.

text type

The text type is the most common type. You can search for equality values e.g. modality = 'US' or inequality values e.g. modality <> 'US' This means return all images whose modality value is not ultrasound. You can search for a set using the IN operator e.g. modality IN ('US', 'MR', 'ES') which is a shorter way of writing modality = 'US' OR modality = 'MR' OR modality = 'ES' You can also search for partial strings using the LIKE operator. To search for images with a specific prefix, use the wildcard character (%) as a suffix e.g. name LIKE 'patient%' This returns all images where the name tag value starts with patient. To search for images with a specific suffix, use the wildcard character as a prefix e.g. name LIKE '%patient' This returns all images where the name tag value ends with patient. To search for images containing a specific word anywhere in its value, use the wildcard character both as a prefix and suffix e.g. name LIKE '%patient%'

number type

You can use the common mathematical operators for numeric tag types i.e. >, <, =, >=, <=, <>. E.g. weight > 60 AND weight <= 80 returns images where the patient large is larger than 60 and less than or equal to 80.

date and time values

DICOM stores date values using the format yyyymmdd. For e.g. 15 March 2021 will be stored as 20210315 in DICOM Search. Time values are stored using the format hhmmss.frac. For e.g. 08:15:05.000 will be stored as 081505.0000. To filter on date and time values, you need to treat the values as numbers. For e.g. to search for images created in April 2020, you need to use the following search criteria: studydate >= 20200401 AND studydate < 20200501 We’re seen how we index our DICOM images and how to search for those images using SQL queries and simplified queries. Now let’s see how we can use the search results.

Section summary

Tag types determine the type of search conditions we can apply to our search.

Related help file topics

Common SQL queries