Showing posts with label lxml. Show all posts
Showing posts with label lxml. Show all posts

Thursday, April 5, 2012

Navigation in an images database with a PyQt application

When recording images taken in a FISH assay, it is convenient to store them hierarchically to take into account the project, the slides, the image location on the slide, the fluorochromes used, the image itself with possible variable exposure time and possibly the variable z value  if 3D imaging is performed (only 2D will be considered).

In a previous post, a xml tree structure was proposed to store that hierarchy.
To navigate through that tree a PyQt4 widget was developed mirroring the tree:
Cascading menus are used in the GUI to navigate in the xml tree
It looks like that:
For this trial the xml tree was not complete. There are two projects, applied or vysis, but only the "applied" project has a complete slide (s1).

Version 002 of the script is here

Thursday, March 1, 2012

Accessing images through a xml object.

I realize that to go further toward an image processing application,  it becomes necessary to  store informations about processed images. Those informations could be stored in a xml object mirroring the tree directories on the hard disk.
Initially I hesitated between an ini file handled with configobj and a xml file. The facilities provided by Lxml convinced me to use that library.
The images are stored as follow: Project / Slide / Field / Fluorochromes/ images. A typical xml object representing a project would be:
<CytoGenet>
  <slide name="A">
    <field name="2" ROI="x0,y0,x1,y1">
      <fluorochrome name="F1">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
      <fluorochrome name="F2">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
    </field>
    <field name="1" ROI="x0,y0,x1,y1">
      <fluorochrome name="F1">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
      <fluorochrome name="F2">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
    </field>
  </slide>
  <slide name="B">
    <field name="1" ROI="x0,y0,x1,y1">
      <fluorochrome name="F1">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
      <fluorochrome name="F2">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
      <fluorochrome name="F3">
        <image position="-1,-1" name="1.TIF" exposure="0.0"/>
      </fluorochrome>
    </field>
  </slide>
</CytoGenet>
For example, we have here a project called Cytogenet, two slides: A or B. In the slide A, two microscopic fields where observed, a region of interest was recorded by its corners (x0,y0) and (x1,y1); the first field was observed with two fluorochromes F1 or F2, and one image was taken for each with a given exposure time.