Python Imaging

Thread Solved

Join Date: Dec 2005
Posts: 4
Reputation: juergenkemeter is an unknown quantity at this point 
Solved Threads: 0
juergenkemeter juergenkemeter is offline Offline
Newbie Poster

Python Imaging

 
0
  #1
Feb 19th, 2006
Hi,

I am thinking about using the Python Imaging Library to display the life cycle of a hair follicle gene. This life cycle is divided into four main stages:
1. Anagen
2. Catagen
3. Telogen
4. Exogen

Gene name and corresponding life cycle stage will be stored in a csv – file or Excel Spreadsheet column.

In a picture of this life cycle, the corresponding gene stage should be highlighted in some way.

The enclosed picture is a rough draft, but should give an idea how the life cycle will look like.

Is it possible to do this with a Python script? Will I have to store different 'versions' of the life cylce, each one highlighting another stage?

As I am merely learning Python at the moment, it would be great to receive tips regarding my project, thanks!

Cheers
Juergen
Attached Thumbnails
LifeCycle.jpg  
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 146
Reputation: G-Do is an unknown quantity at this point 
Solved Threads: 28
G-Do's Avatar
G-Do G-Do is offline Offline
Junior Poster

Re: Python Imaging

 
0
  #2
Feb 20th, 2006
Hi juergenkemeter,

You want to set up some kind of GUI window that displays the main hair follicle life cycle image, such that when you click the mouse (or press the space key, or enter some other input) a new layer pops up, with maybe a tinted, transparent shape over the relevant stage, and also a list of genes which are differentially expressed at that stage. And you want to set this up so that each input takes you to the next stage of the life cycle. Right?

I don't know how to do any of that! Well, maybe I know how to set up the GUI window and the main image, but I have never played with the Python imaging library. If we took a time machine back two years ago, my past self could probably have showed you how to do all this stuff with Java/Swing, but sadly, I have long since forgotten my Java roots.

The actual reason for my response is pedantic: I don't think it is correct to say "the life cycle of a hair follicle gene." Genes are not alive and they do not have "life cycles" in any conventional sense of the term (though an argument could be made for genes that undergo VDJ recombination, I suppose). A more exact way of phrasing what you mean (I think) is: "I want to display the life cycle of a hair follicle and show the differential gene expression at each phase transition."

Is this what you are trying to do?
Vi veri veniversum vivus vici
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 4
Reputation: juergenkemeter is an unknown quantity at this point 
Solved Threads: 0
juergenkemeter juergenkemeter is offline Offline
Newbie Poster

Re: Python Imaging

 
0
  #3
Feb 20th, 2006
Hi,
I thought about two ways to do that.

1. One basic image, which has accurate basic detail level, but no highlighting so far.
(e.g. form of a ‘6’)

2. Provide a fixed placeholder in the Sheepgenomics webpage, or provide another means to display the graphics, e.g. through clicking a Hyperlink which calls the Python imaging function, creating a corresponding image regarding the gene data
o This Python script should take the basic image, alter it according to a RULESET (accessing table gene data, i.e. in which stage the gene is at the moment), and then display the gene stage in the basic image.
o OR, if there should only be a fixed number of stages highlighted, store 4, 5, 6 different-looking images (different stages already highlighted), and then display the corresponding picture according to the underlying, stored stage data of the gene
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 4
Reputation: juergenkemeter is an unknown quantity at this point 
Solved Threads: 0
juergenkemeter juergenkemeter is offline Offline
Newbie Poster

Re: Python Imaging

 
0
  #4
Feb 20th, 2006
Please read the next answer I have written, as I was too late to modify my previous response:

Hi,

The main aim would be to display a highlighted graphic. It is not necessary to provide gene information, too.

There will be a fixed number of stages. Therefore perhaps store various different-highlighted basic images, and then display the corresponding picture according to the gene data

I have given some thought to a suitable diagram. One option would be to use a diagram similar which you can see on page:
http://photobucket.com/albums/a19/juergenkemeter/

The diagram represents follicle development in the foetal skin (stages 0 to 8) and then the 4 main stages of the follicle growth cycle in the adult (anagen, catagen, telogen and proanagen). It has lists of the main processes involved at each stage.

The diagram is quite large which will be an issue - maybe it would have to open as a separate window.

Also, is there a possibility to underlay a highlighted section of an image with hyperlinks referencing original experiment data?

Cheers
Juergen
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,003
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 928
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Python Imaging

 
0
  #5
Feb 20th, 2006
Take a look at these two PIL examples and see if you can apply them to your task ...
  1. # using the PIL Python Image Library:
  2. # get a region of an image
  3.  
  4. import Image
  5.  
  6. # open an image file (.bmp,.jpg,.png,.gif) you have in the working folder
  7. im1 = Image.open("Donald.gif")
  8.  
  9. # set up a 100x100 pixel tuple-box(ulcX, ulcY, lrcX, lrcY)
  10. # coordinate ulcX = upper left corner X ...
  11. box = (30, 30, 130, 130)
  12.  
  13. # now crop that region and assign to im2
  14. im2 = im1.crop(box)
  15.  
  16. # brings up the modified image in a viewer, simply saves the image as
  17. # a bitmap to a temporary file and calls viewer associated with .bmp
  18. im2.show()

  1. # using the PIL Python Image Library:
  2. # insert a small image into a larger image
  3.  
  4. import Image
  5.  
  6. def watermark(image, thumb):
  7. """inserts thumb into image, modified image is returned"""
  8. imageX, imageY = image.size
  9. thumbX, thumbY = thumb.size
  10. if thumbX < imageX and thumbY < imageY:
  11. point1 = imageX - (thumbX + 10)
  12. point2 = imageY - (thumbY + 10)
  13. point3 = imageX - 10
  14. point4 = imageY - 10
  15. image.paste(thumb, (point1, point2, point3, point4))
  16.  
  17. if __name__ == '__main__':
  18. # load two images, pick something you have
  19. # thumb1 should be smaller in size than image1
  20. image1 = Image.open('Audi.jpg')
  21. thumb1 = Image.open('Audi2.jpg')
  22. watermark(image1, thumb1)
  23. image1.show()
Last edited by vegaseat; Jan 30th, 2008 at 1:00 am. Reason: replaced php code tags
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC