Tuesday, March 29, 2011

Trying to make an images mosaic with matplotlib

 In ImageJ, it is easy to make an images gallery with make montage.
Complete particles gallery made with make montage in imagej
The script to produce the particles from the metaphase is here. The end of the code tries to produce a particles (single/overlapping chromomes, nuclei) gallery using pylab.subplot, it is commented because it doesn't work.
I get the answer at pythonvision:


import readmagick
import pylab
import os

user=os.path.expanduser("~")
workdir=os.path.join(user,"Applications","ImagesTest","jp","Jpp48","13","DAPI","particules")
file="part1.png"
if __name__ == "__main__":
    file="part1.png"
    complete_path=os.path.join(workdir,file)
    i1=readmagick.readimg(complete_path)
    file="part2.png"
    complete_path=os.path.join(workdir,file)
    i2=readmagick.readimg(complete_path)
    file="part3.png"
    complete_path=os.path.join(workdir,file)
    i3=readmagick.readimg(complete_path)
    file="part4.png"
    complete_path=os.path.join(workdir,file)
    i4=readmagick.readimg(complete_path)
    pylab.subplot(2,2,1)
    pylab.imshow(i1) 
    pylab.subplot(2,2,2)
    pylab.imshow(i2)
    pylab.subplot(2,2,3)
    pylab.imshow(i3)
    pylab.subplot(2,2,4)
    pylab.imshow(i4)
    pylab.show() 
Removing the axis from the displayed images:
Axis can be removed  from the images as follow:

pylab.subplot(2,2,1,frameon=False, xticks=[], yticks=[])
 
click to enlarge

No comments: