Skip to content

Commit

Permalink
Merge pull request #2 from fcollman/master
Browse files Browse the repository at this point in the history
fixed stage flip error, added timing debug statements.
  • Loading branch information
jcornford committed Nov 4, 2015
2 parents a658182 + af6122e commit 63e7a10
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ImageCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def display8bit(self,image, display_min, display_max):
image = np.array(image, copy=True)
image.clip(display_min, display_max, out=image)
image -= display_min
image //= (display_max - display_min + 1) / 256.
image = image / ((display_max - display_min + 1) / 256.)
return image.astype(np.uint8)

def lut_convert16as8bit(self,image, display_min, display_max) :
Expand Down
2 changes: 1 addition & 1 deletion MosaicImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def align_by_correlation(self,xy1,xy2,CorrSettings = CorrSettings()):


print "one_cut,two_cut.shape",one_cut.shape,two_cut.shape
pix_shift, error, diffphase=register_translation(one_cut,two_cut,upsample_factor=20)
pix_shift, error, diffphase = register_translation(one_cut,two_cut,upsample_factor=20)

dy_pix,dx_pix = pix_shift

Expand Down
15 changes: 10 additions & 5 deletions MosaicPlanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
from FocusCorrectionPlaneWindow import FocusCorrectionPlaneWindow
import pickle
import faulthandler
import datetime



class MosaicToolbar(NavBarImproved):
Expand Down Expand Up @@ -395,30 +397,33 @@ def write_session_metadata(self,outdir):
f.write(self.channel_settings.prot_names[ch] + "\t" + "%f\t%s\n" % (self.channel_settings.exposure_times[ch],ch))

def MultiDAcq(self,outdir,x,y,slice_index,frame_index=0):


print datetime.datetime.now().time()," starting multiDAcq, autofocus on"
self.imgSrc.set_hardware_autofocus_state(True)
print datetime.datetime.now().time()," starting stage move"
self.imgSrc.move_stage(x,y)
attempts=0

print datetime.datetime.now().time()," starting autofocus"
if self.imgSrc.has_hardware_autofocus():
#wait till autofocus settles
while not self.imgSrc.is_hardware_autofocus_done():
time.sleep(.1)
time.sleep(.05)
attempts+=1
if attempts>100:
print "not auto-focusing correctly.. giving up after 10 seconds"
break
time.sleep(.1) #wait an extra 100 ms for settle


self.imgSrc.set_hardware_autofocus_state(False) #turn off autofocus

else:
score=self.imgSrc.image_based_autofocus(chan=self.channel_settings.map_chan)
print score

time.sleep(.05)
print datetime.datetime.now().time()," starting multichannel acq"
currZ=self.imgSrc.get_z()
for k,ch in enumerate(self.channel_settings.channels):
print datetime.datetime.now().time()," start channel",ch
prot_name=self.channel_settings.prot_names[ch]
path=os.path.join(outdir,prot_name)
if self.channel_settings.usechannels[ch]:
Expand Down
32 changes: 16 additions & 16 deletions imageSourceMM.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ def set_xy(self,x,y,use_focus_plane=False):
if use_focus_plane:
z = self.get_focal_z(x,y)
self.set_z(z)
if flipx==1:
x = -x
if flipy == 1:
y = -y
#if flipx==1:
# x = -x
#if flipy == 1:
# y = -y

stg=self.mmc.getXYStageDevice()
self.mmc.setXYPosition(stg,x,y)
Expand All @@ -203,10 +203,10 @@ def get_xy(self):
x=self.mmc.getXPosition(xystg)
y=self.mmc.getYPosition(xystg)

if flipx:
x = -x
if flipy:
y = -y
#if flipx:
# x = -x
#if flipy:
# y = -y

return (x,y)
def get_z(self):
Expand Down Expand Up @@ -255,14 +255,14 @@ def snap_image(self):
#snap a picture, and return the data as a numpy 2d array
self.mmc.snapImage()
data = self.mmc.getImage()
(flipx,flipy,trans) = self.get_image_flip()
print "flx,y,trans",flipx,flipy,trans
if trans:
data = np.transpose(data)
if flipx:
data=np.fliplr(data)
if flipy:
data=np.flipud(data)

#(flipx,flipy,trans) = self.get_image_flip()
#if trans:
# data = np.transpose(data)
#if flipx:
# data=np.fliplr(data)
#if flipy:
# data=np.flipud(data)
return data


Expand Down

0 comments on commit 63e7a10

Please sign in to comment.