Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
eyes:logics:sql [2017/06/12 16:44]
gbunzel [Process]
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% >|
Line 64: Line 64:
 |< 100% 30% >| |< 100% 30% >|
 ^ New/Changed Header Values ^ Description ^ ^ New/Changed Header Values ^ Description ^
-| headerValue1 | what does it say? how is it changed? | +New or changed ​header values depend on how this logic is used, since header values can be added or modified by this logic.
-| headerValue2 | what does it say? how is it changed? | +
-| headerValue3 | what does it say? how is it changed? | +
-| headerValue4 | what does it say? how is it changed? |+
  
 ===== Concept ===== ===== Concept =====
-In this paragraph, the "​HOW ​logic works under the hood" and WHY someone should use it can be elaborated with higher detailDescribes a scenario in an image processing workflow where this logic can be used to solve the resulting ​problem. Also, wikipages, publications or anything else describing ​the theory behind an algorithm should be linked here, if applicable.+This module creates ​database which is basically ​the union of all input header valuesThen the given SQL statement is applied onto this database and the resulting ​header keys (with the corresponding images) are written to the output.