MERAQuery¶
-
MLModule
¶ genre MERA
author Wolf Spindler
package FMEstable/ReleaseMeVis
dll MLMERA
definition MLMERA.def see also MERAVolumeInspector
,MERACrawler
keywords query
,search
,index
,find
,volume
,storage
Purpose¶
MERAQuery
performs a query on an index and a volume storage which have been created with MERACrawler
. It allows searching for DICOM tags or values, as well as joined queries. Queries can be defined completely with the Query tab as well as manually in User Command.
Parameter Fields¶
Field Index¶
Visible Fields¶
Absolute Volume Storage Directory¶
-
name:
absoluteVolumeStorageDirectory
, type:
String
¶ The absolute directory path to the MERA volume storage.
#Queries¶
-
name:
numberOfQueryRows
, type:
Integer
, default:
1
¶ The number of query rows to be shown. If more than one query row is enabled than also
joinMode00
andjoinCondition00
inputs are displayed to decide how the queries shall be composed.
Run Query (Ctrl R)¶
User Command¶
-
name:
userCommand
, type:
String
¶ An input for a user defined SQLite command which can be run by notifying
Run User Command (Ctrl U)
. Note that such commands may become incompatible in the case of changes of the data base backend of MERA. For details about SQLite see https://www.sqlitetutorial.net and https://www.sqlitetutorial.net/sqlite-commands.For SQLite commands the structures and the names of data bases, tables, and columns need to be known:
- Each search term, as defined under Search a, corresponds to its own data base and has an associated value.
- The number of keys which can be used in a command is identical to the number of selected query rows in
#Queries
. - The data bases are automatically opened and attached before, and closed after running the user command. They are those ones selected by
keyType00
etc. under Search a. If DICOM tags are selected then the with Tag IDtagId00
etc. describe the specific tag data base. - The SQLite names of the data bases are main, DB2, …, DB9 corresponding to the ten query rows.
- Each data base contains only one single table with the name KeyValuesPair containing the columns VolumeId and Value.
For own commands a good way to start is to copy the SELECT command output from
Report
afterRun Query (Ctrl R)
intoUser Command
and pressRun User Command (Ctrl U)
.An example query: search ids of volumes with Modality NM whose PatientName tags contain Anonym.
- Use two
#Queries
. - In the Query tab configure one row with DICOMTag Value Flat with tag id Modality and the second one with tag id PatientName.
The data base names will be main and DB2, each one contains a single table named KeyValuesPair. Each table has the two columns VolumeId and Value. In the table in main, the Value column contains the content of the modality tags such as CT, NM, etc. In the table in DB2, the Value column contains the content of PatientName tags such as LastName^First, Musterman^Manfred, etc. In both cases the VolumeId columns contain the ids of the volumes which contain these tags and which can be used in the
MERAVolumeInspector
to inspect these volumes.Then the query could look like
SELECT main.KeyValuesPair.VolumeId FROM main.KeyValuesPair WHERE main.KeyValuesPair.Value = 'NM' INTERSECT SELECT DB2.KeyValuesPair.VolumeId FROM DB2.KeyValuesPair WHERE DB2.KeyValuesPair.Value GLOB '*Anonym*'
If names are not ambiguous their names can be shortened:
SELECT VolumeId FROM main.KeyValuesPair WHERE Value = 'NM' INTERSECT SELECT VolumeId FROM DB2.KeyValuesPair WHERE Value GLOB '*Anonym*'
Pressing
Run User Command (Ctrl U)
loads the data bases, runs the command, logs the found volume ids inReport
and setsVolume Ids
according to the settings inIndex of First Id
andMax # Volume Ids
.Another more complex example: Search all Ids of volumes from the same study in which there is at least one NM and one PT volume. For this purpose use two
#Queries
and configure the first query row with DICOMTag Value Flat with tag id Modality and the second one with tag id StudyInstanceUID. Note that such queries can take longer on larger data bases since multiple INNER JOIN commands are executed:SELECT Mod1.VolumeId, Mod2.VolumeId, N1.VolumeId, N1.Value, N2.Value FROM main.KeyValuesPair AS Mod1 INNER JOIN main.KeyValuesPair AS Mod2 ON (Mod1.Value = 'NM') AND (Mod2.Value = 'PT') INNER JOIN DB2.KeyValuesPair AS N1 ON (Mod1.VolumeId = N1.VolumeId) INNER JOIN DB2.KeyValuesPair AS N2 ON (Mod2.VolumeId = N2.VolumeId) AND (N1.value = N2.Value) AND (Mod2.VolumeId=N2.VolumeId) GROUP BY N1.value
Run User Command (Ctrl U)¶
-
name:
runUserCommand
, type:
Trigger
¶ Run the user command defined in
User Command
.
Also On Value¶
-
name:
selectAlsoOnValue
, type:
Bool
, default:
FALSE
¶ If multiple query rows are used and join mode is neither LEFT nor INNER, then SELECT runs only on the VolumeId but not on the value; if this checkbox is enabled then SELECT runs on VolumeId, Value. Note that this may lead to different results since join commands such as INTERSECT then also include the value in their calculation.
Volume Ids¶
-
name:
volumeIds
, type:
String
, persistent:
no
¶ Lists the ids of all volumes found in the most recent query in a format that it can be connected to a
MERAVolumeInspector.volumeIndexList
ofMERAVolumeInspector
.
Index of First Id¶
-
name:
queryResultsStart
, type:
Integer
, default:
0
, maximum:
:field:`numUniqueQueryResults`
¶ The index of the first found Volume Id to be shown in
Volume Ids
.
Max # Volume Ids¶
-
name:
maxNumQueryResults
, type:
Integer
, default:
500
¶ The maximum number of queries to be passed to the
Volume Ids
output; note that large values may degrade performance.
# Result Ids¶
-
name:
numUniqueQueryResults
, type:
Integer
, persistent:
no
¶ A read-only field displaying the number of found volume ids.
Report Buffer Size¶
Report¶
-
name:
report
, type:
String
, persistent:
no
¶ Displays information about the most recently run
Run Query (Ctrl R)
.
Preload Cache Directory¶
-
name:
preloadCacheDirectory
, type:
String
¶ If large and optimally fast local disk space is available then setting up a cache directory on it is recommended. This can speed up query launch time tremendously especially for slower network connections to the data MERA volume storage. If left empty then no caching is performed.