Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
eyes:logics:sql [2017/06/12 16:50] gbunzel [Concept] |
eyes:logics:sql [2017/06/12 18:31] (current) jschlie1 |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Sql ====== | + | ====== SQL ====== |
| This logic can be used to perform database related operations on header keys of one or two stacks of images to filter them for certain criteria. | This logic can be used to perform database related operations on header keys of one or two stacks of images to filter them for certain criteria. | ||
| Line 7: | Line 7: | ||
| ===== Example ==== | ===== Example ==== | ||
| - | *reproduce the input (default value) | + | *Reproduce the input (default value) |
| ''SELECT *, FROM t0'' | ''SELECT *, FROM t0'' | ||
| - | *rename | + | *Rename |
| '' SELECT *,classID as clusterMember FROM t0'' | '' SELECT *,classID as clusterMember FROM t0'' | ||
| - | *perfom arithmetic on certain header value | + | *Perfom arithmetic on certain header value |
| '' SELECT *, (referenceData -120) as referenceData FROM t0 '' | '' SELECT *, (referenceData -120) as referenceData FROM t0 '' | ||
| - | *count distinct values, example given by //referanceData// from alignment. t0 := projections, t1 := ali images | + | *Count distinct values, example given by //referanceData// from alignment. t0 := projections, t1 := ali images |
| '' SELECT DISTINCT t0.*, COUNT(t1.referenceData) as counter FROM t0, t1 WHERE t1.referenceData == t0.imageID GROUP BY t1.referenceData '' | '' SELECT DISTINCT t0.*, COUNT(t1.referenceData) as counter FROM t0, t1 WHERE t1.referenceData == t0.imageID GROUP BY t1.referenceData '' | ||
| - | *select only even images (repleace =0 with =1 for odd images) | + | *Select only even images (repleace =0 with =1 for odd images) |
| '' SELECT * FROM t0 where img%2=0 '' | '' SELECT * FROM t0 where img%2=0 '' | ||
| - | *calculate the average of parameter //imageID// for a given condition (where clause) | + | *Calculate the average of parameter //imageID// for a given condition (where clause) |
| '' SELECT sum(imageID)/count(imageID) as sum FROM t0 where imageID >10 and imageID < 20 '' | '' SELECT sum(imageID)/count(imageID) as sum FROM t0 where imageID >10 and imageID < 20 '' | ||
| | | ||
| - | *count the number of distinct values for the header key //croppedFromFile// and order the output by that key, output will consist of 1 image per unique value | + | *Count the number of distinct values for the header key //croppedFromFile// and order the output by that key, output will consist of 1 image per unique value |
| '' SELECT *, COUNT(croppedFromFile) FROM t0 GROUP BY croppedFromFile '' | '' SELECT *, COUNT(croppedFromFile) FROM t0 GROUP BY croppedFromFile '' | ||
| Line 38: | Line 38: | ||
| '' SELECT * FROM t0 WHERE eulerBeta = 130 AND eulerGamma BETWEEN 190 AND 195 '' | '' SELECT * FROM t0 WHERE eulerBeta = 130 AND eulerGamma BETWEEN 190 AND 195 '' | ||
| - | *mirror the euler angles of particles (for angular distribution plot with //eulerBeta// and //eulerGamma// in Value Viewer) | + | *Mirror the euler angles of particles (for angular distribution plot with //eulerBeta// and //eulerGamma// in Value Viewer) |
| '' SELECT *, (180-eulerBeta) AS eulerBeta, | '' SELECT *, (180-eulerBeta) AS eulerBeta, | ||
| CASE | CASE | ||
| Line 46: | Line 46: | ||
| AS eulerGamma FROM t0 '' | AS eulerGamma FROM t0 '' | ||
| - | ===== Process ===== | + | ===== Parameters and I/O ===== |
| |< 100% 30% >| | |< 100% 30% >| | ||