Project

General

Profile

Actions

Bug #2437

closed

automasker.py shape mismatch?

Added by Gabriel Lander over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
-
Start date:
07/24/2013
Due date:
% Done:

0%

Estimated time:
Affected Version:
Appion/Leginon 3.0.0
Show in known bugs:
No
Workaround:

Description

I'm trying to run the automasker on data collected on the T2 DD. I'm using /opt/myamisnap/bin appion. I get this error on the first image:

Beginning Main Loop

Starting image 1 ( skip:1201, remain:1672 ) id:1970578, file: 12oct30b_021hl_03ed
... Pixel size: 1.424
... Converting mrc image to jpg.
... running em hole finder Wed Jul 24 09:14:31 2013
source /opt/em_hole_finder/env/bin/activate; python /opt/em_hole_finder/find_mask_amber_dev.py --ifile=/ami/data15/appion/glander/12oct30b/mask/maskauto1/jpgs/12oct30b_00021hl_v02_00003ed.jpg --ofile=/ami/data15/appion/glander/12oct30b/mask/maskauto1/masks/12oct30b_00021hl_v02_00003ed_mask.jpg --downsample=20 --compsizethresh=50 --adapthresh=500 --blur=10 --dilation=10 --erosion=1

==== Committing data to database ==== 
... Writing results to database: Wed Jul 24 09:14:49 2013
... MRC Image Shape:
[3072 4096]
... MRC Image Size:
12582912
... Mask Image Shape:
(124, 175)
... resizing mask image.
24.7741935484
... Mask Image Shape:
(3072, 4335)
... getting mask region info.
getting region info
Getting real perimeter length
Getting real mean and stdev
Traceback (most recent call last):
File "/ami/sw/packages/myamitrunk/appion/bin/automasker.py", line 317, in <module>
function.run()
File "/ami/sw/packages/myamitrunk/appion/appionlib/appionLoop2.py", line 97, in run
self.loopCommitToDatabase(imgdata)
File "/ami/sw/packages/myamitrunk/appion/appionlib/appionLoop2.py", line 146, in loopCommitToDatabase
return self.commitToDatabase(imgdata)
File "/ami/sw/packages/myamitrunk/appion/bin/automasker.py", line 167, in commitToDatabase
infos,testlog = apCrud.getLabeledInfo( imgdata['image'], img3, labeled_regions, range(1,clabels+1), False, infos, testlog)
File "/ami/sw/packages/myamitrunk/appion/appionlib/apCrud.py", line 349, in getLabeledInfo
info=getRealLabeledMeanStdev(image,labeled_image,indices,info)
File "/ami/sw/packages/myamitrunk/appion/appionlib/apCrud.py", line 232, in getRealLabeledMeanStdev
mean=nd.mean(image,labels=labeled_image,index=indices)
File "/usr/lib64/python2.6/site-packages/scipy/ndimage/measurements.py", line 141, in mean
labels = _broadcast(labels, input.shape)
File "/usr/lib64/python2.6/site-packages/scipy/ndimage/measurements.py", line 417, in _broadcast
return_value[sslices] = arr[aslices]
ValueError: shape mismatch: objects cannot be broadcast to a single shape

Related issues 1 (0 open1 closed)

Related to Appion - Feature #2319: Add Auto Masking (em_hole_finder) to pipelineClosedAmber Herold04/08/2013

Actions
Actions #1

Updated by Amber Herold over 11 years ago

  • Status changed from New to Assigned
  • Assignee set to Amber Herold

Looks that way. I'll take a look at it today.

Actions #2

Updated by Amber Herold over 11 years ago

OK - I got this working on rectangular images now.
You can see the result of your first image here: http://longboard.scripps.edu/betamyamiweb/processing/multiimgassessor.php?expId=12039&maskId=1

The the em_hole_finder does some decimation and cropping that does not necessarily maintain the aspect ratio of rectangular images.
For the DD images, set the --downsample flag to 32. This is a good number for images that are [3072,4096] shape. In the em-hole finder code, I have changed the cropping function from always cropping by 15 pixels on all sides, to cropping 1/8th of the image relative to the x and y sizes. This preserves the aspect ratio better, but rounding errors still leave us off by 8 pixels when trying to upload. To address that, I am zooming the mask in the x direction and y direction at different ratios, depending on how far off the aspect ratio of the mask is.

I have checked in the changes to automasker.py, which should be available from amiboxes tomorrow. I will copy find_mask_amber_dev.py and pipeline_amber_dev.py from Guppy (where the updates are) to the amiboxes. On a side note, we need to find a good place to put those under source control.

This should get you up and running for now. A better solution will be to automatically set a good downsample size in the web gui by finding common factors, then choosing one that will result in a mask size that has a common factor in the x and y direction near 10.

Actions #3

Updated by Amber Herold over 11 years ago

  • Status changed from Assigned to In Test
  • Assignee changed from Amber Herold to Gabriel Lander
  • Affected Version changed from Appion/Leginon 2.1.0 to Appion/Leginon 3.0.0

Gabe, I've copied over some new code to amibox02. Go ahead and give it another try tomorrow morning, after updates from svn are in place. As stated above, set the --downsample flag to 32.

Actions #4

Updated by Gabriel Lander over 11 years ago

  • Status changed from In Test to Closed

Works!

Actions

Also available in: Atom PDF