Class: SectionDataSet
- Inherits:
-
DataSet
- Object
- ActiveRecord::Base
- DataSet
- SectionDataSet
- Includes:
- CoreBase
- Defined in:
- app/models/section_data_set.rb
Overview
SectionDataSet is an experiment conducted on sections of tissue. These sections are ordered respecting their position in the brain. The images are represented by the [SectionImage] model.
Direct Known Subclasses
Instance Method Summary (collapse)
- - (Object) label
-
- (Object) reference_images
method to allow override of images used for reference.
-
- (Object) reference_to_image(rx, ry, rz)
Find the closest image and (x,y) to user specified 3D location.
Methods inherited from DataSet
Instance Method Details
- (Object) label
27 28 29 |
# File 'app/models/section_data_set.rb', line 27 def label "#{treatments[0].label} - #{probes[0].label} - #{specimen.donor.organism.label}" end |
- (Object) reference_images
method to allow override of images used for reference
82 83 84 |
# File 'app/models/section_data_set.rb', line 82 def reference_images self.section_images end |
- (Object) reference_to_image(rx, ry, rz)
Find the closest image and (x,y) to user specified 3D location
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/models/section_data_set.rb', line 32 def reference_to_image( rx, ry, rz ) # ----- transform reference rx,ry,rz to volume vx,vy,vz xrv = self.alignment3d if xrv vx = xrv.trv_00 * rx + xrv.trv_01 * ry + xrv.trv_02 * rz + xrv.trv_09 vy = xrv.trv_03 * rx + xrv.trv_04 * ry + xrv.trv_05 * rz + xrv.trv_10 vz = xrv.trv_06 * rx + xrv.trv_07 * ry + xrv.trv_08 * rz + xrv.trv_11 else vx = rx vy = ry vz = rz end # ---- search for closest sub_image #thickness = 25 # thickness hardcode to 25 micron should be a function of image-series min_diff = 10**6 min_sub_image = nil self.reference_images.each { |si| # no need to check for failed sub-images in warehouse if (!si.nil? && !si.section_number.nil? && !self.section_thickness.nil?) diff = (si.section_number * self.section_thickness - vz).abs if diff < min_diff min_diff = diff min_sub_image = si end end } if min_sub_image == nil return nil end # transfrom vx,vy to sub_image sx,sy xvs = min_sub_image.alignment2d if xvs sx = xvs.tvs_00 * vx + xvs.tvs_01 * vy + xvs.tvs_04 sy = xvs.tvs_02 * vx + xvs.tvs_03 * vy + xvs.tvs_05 else return nil end return min_sub_image.id, min_sub_image.section_number, sx, sy end |