Project

General

Profile

Actions

Feature #4932

open

Should we add scaling (as opposed to binning) in makestack: box size divided by bin size is a float in makestack

Added by Neil Voss over 7 years ago. Updated over 7 years ago.

Status:
Assigned
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
04/26/2017
Due date:
% Done:

0%

Estimated time:

Description

Traceback (most recent call last):
  File "/opt/applications/myami/3.2/bin/makestack2.py", line 1352, in <module>
    makeStack.run()
  File "/opt/applications/myami/3.2/lib/python2.7/site-packages/appionlib/appionLoop2.py", line 65, in run
    self.preLoopFunctions()
  File "/opt/applications/myami/3.2/bin/makestack2.py", line 1234, in preLoopFunctions
    self.summedParticles = numpy.zeros((binbox, binbox))
TypeError: 'float' object cannot be interpreted as an index

I think the problem is:

"Bin the particles after extracting (can be float if making a RELION stack)" 

Related issues 1 (0 open1 closed)

Related to Appion - Bug #5044: as of last night can no longer create stack using myami/3.2Closed06/23/2017

Actions
Actions #1

Updated by Neil Voss over 7 years ago

Hi Gabe, Do you know anything about this. I want to change the binning back to an integer, because I am not sure how to deal with a float. What should the behavior be is the user selected an unbinned box size of 128 and binning of 3, giving a final box size of 42.67 pixels

Introduced in commit:523bcc0c

Actions #2

Updated by Gabriel Lander over 7 years ago

In the makestack webpage you set the final desired box size if you choose a Relion stack. If I extract at 256 & want a 100x100 final box size, the binning will be set to 2.56
There shouldn't be a way to set a final box size as the a float in the gui, so it's odd that you're getting this error. Maybe we should add code to ensure that the binned box size is an even int value?

Actions #3

Updated by Neil Voss over 7 years ago

So, you are scaling the image not binning it correct. Should we have a different parameter for scaling, since it involves some interpolation.

Actions #4

Updated by Neil Voss over 7 years ago

At a minimum, we need to add a check conflict such that boxsize/bin == int(boxsize/bin)

Actions #5

Updated by Gabriel Lander over 7 years ago

You're right, it's not binning, Relion scales by windowing in Fourier space. I'm ok with a new parameter for Relion scaling, it doesn't matter to me what we call it. I just figured we could use the binning parameter if we had checks in the code, since this is transparent to most users.

Actions #6

Updated by Neil Voss over 7 years ago

Okay, what do we do? I want to make binning an integer again.

Actions #7

Updated by Gabriel Lander over 7 years ago

If you want it to be an integer then we need to add a new parameter called scaling.

Actions #8

Updated by Neil Voss over 7 years ago

What is the purpose of scaling? I thought it would be something you want to avoid.

Separating bin from scaling would be the cleanest. Instead of scaling factor, should you just input the original boxsize and the final scaled boxsize.

Actions #9

Updated by Gabriel Lander over 7 years ago

for initial 2D & 3D we scale everything down to 100 pixels & then unbin for final refinements. If the box size is too large for the GPU workstations, we scale to 1 Å/pixel for the final refinements. Since Relion scales by Fourier windowing it doesn't have to be an integer. I'm fine with setting a final output box size or desired pixel size.

Actions #10

Updated by Neil Voss over 7 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from box size divided by bin size is a float in makestack to Should we add scaling (as opposed to binning) in makestack: box size divided by bin size is a float in makestack
  • Assignee changed from Gabriel Lander to Neil Voss

I wanted to expand the issue to more eyes and opinions on this issue. After some thought, I am opposed to adding scaling, but I will go with the majority.

So Pro/Cons to adding scaling to makestack:

Pros:
  • expanded choice of box size -- Gabe's case cut out 256 pixels scale to 100 pixels for 2D alignment. Response to this, Gabe could also use 288pixel/3bin->96pixels, 256/4->64, 240/3->80, 256/2->128. None of these are perfect.
  • matches feature provided in RELION -- users will say that RELION let's me do it, so Appion is old
Cons:
  • reduced signal-to-noise in final particles -- As I understand it, binning increases the signal-to-noise ratio (SNR), while scaling maintains the same SNR. I was having trouble finding documentation on this.
  • complicates box size selection, scale and bin, just scale, etc.
Actions #11

Updated by Anchi Cheng over 7 years ago

Relion scaling is in Fourier space. It then means cutting off high frequency component which should increase S/N ratio in real space in some form assuming white noise (present at all frequency) and that the signal is well below noise beyond the cutoff. I think the feature is valid and should be there. From what Gabe said, it is used for in practice. I am for it.

Actions #12

Updated by Neil Voss over 7 years ago

I am for it if we do the scaling in Fourier space. I did not want to do any more bilinear scaling.

Scott has been opposed to this in the past. Mainly because cutting the frequencies off like this will produce artifacts, especially when fiducial markers are present. We would need to consider using Hann window filter if doing this.

Actions #13

Updated by Scott Stagg over 7 years ago

Sorry for the duplicate message. I am on vacation and just got to a computer instead of my phone. Yes, my feelings on binning vs Fourier scaling are unchanged. I'm OK if we add Fourier scaling as a new option. I think Neil summed it up nicely. I like binning because it increases the signal to noise ratio especially for integrating cameras (as I understand it), and it doesn't have potential for artifacts like Fourier scaling does. I think it's fine if we add it as an option that is not the default, and old binning is still there. It's also worth looking at the results of the reconstruction challenge. I think there may be a trend where data processed with scaling perform worse than those with binning, but that will need a little more analysis.

Actions #14

Updated by Neil Voss over 7 years ago

I guess my next problem, how can we best present this on the web page. I envision, a initial box size and reduced box size.

If the reduced box size divides the initial box size, we use binning otherwise it will be Fourier scaling. Also, I would include a javascript message to say what type of binning/scaling will be used.

I'll start a prototype of this.

Actions #15

Updated by Gabriel Lander over 7 years ago

I'm not sure why this became such a big discussion. My intentions was that the scaling option is ONLY available/used when you select RELION as the the output stack, in which case the Relion package is used to generate the particle stack (only box files are made using appion). Relion always performs Fourier windowing, even if you're scaling by 0.5
The makestack web gui options should change when you switch from "imagic" stack to "relion" stack to reflect this.

Actions #16

Updated by Gabriel Lander over 7 years ago

"The makestack web gui options should change when you switch from "imagic" stack to "relion" stack to reflect this." meaning, I already spent time at the last hackathon putting in the javascript to do this & update the output pixel size in real time as you change the output box size.

Actions #17

Updated by Neil Voss over 7 years ago

Well it broke some of the python, why should a feature be available for RELION and not in the standard, when we have to handle it in python either way.

Actions #18

Updated by Anchi Cheng over 7 years ago

I am on Gabe's side. If we insist on every package has the same function, we will end up with slow code that we write ourselves and no one with 100k or more particles will want to use any part of it.

Neil, if you do not want the feature to break on python side, put in validation to prevent it going to unhappy path. That should be enough.

As for the gui, I think give it the final pixel size and number of pixels in the boxed particle is the easiest for the user. As long as it is a separate option from real-space binning, it is good.

Actions #19

Updated by Neil Voss over 7 years ago

I am of the opinion that it is easier to have to work for both, it complicates things to have a feature for one thing and not the other.

Actions #20

Updated by Neil Voss over 7 years ago

  • Related to Bug #5044: as of last night can no longer create stack using myami/3.2 added
Actions

Also available in: Atom PDF