Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flipping function based on header information...? #113

Open
jonwright opened this issue May 5, 2017 · 8 comments
Open

Add a flipping function based on header information...? #113

jonwright opened this issue May 5, 2017 · 8 comments

Comments

@jonwright
Copy link
Collaborator

We often get edfimages that are mistakenly flipped during data collection. There is a header item which tells us this flipping was done. Can we add something to put them back to the original orientation, for example:

def headerFlip( hdr, data ):
# interpret <flip x : False,flip y : True>
x,y = hdr.split(",")
ret = data
if x.find("True")>0:
ret = numpy.fliplr( data )
if y.find("True")>0:
ret = numpy.flipud( data )
return ret

@kif
Copy link
Member

kif commented May 5, 2017 via email

@jonwright
Copy link
Collaborator Author

jonwright commented May 15, 2017 via email

@vallsv
Copy link
Contributor

vallsv commented May 16, 2017

Hi. This kind of feature sounds fine, but it have to be taken very carefully. It can break a lot of things.

BTW do you have a sample for us?

@vallsv
Copy link
Contributor

vallsv commented May 16, 2017

Lima looks to define this set of metadata (https://github.com/esrf-bliss/Lima/blob/master/control/src/CtImage.cpp#L1061):

  • image_bin
  • image_roi
  • image_flip
  • image_rotation

@jonwright
Copy link
Collaborator Author

jonwright commented May 16, 2017 via email

@vallsv
Copy link
Contributor

vallsv commented May 17, 2017

I think the main problem is not the implementation but the way to implement it and to stay compatible with the previous code. You must have still access to the raw data, and it also can create conceptual problem to convert or copy an image using the lib.

For data acquisition, we recommend not to apply software transformation on the image but to custom your display software if you want to see the image in a different way (then avoid flip and rot).

  • Cause in this way you lose the close relation existing between the detector geometry and the data (pixels at different locations on your detector do not have the same meaning)
  • And it's computation for nothing

But for a generic library, it can make sense while it is normalized.

@vallsv
Copy link
Contributor

vallsv commented Jun 14, 2017

We talk about that with Jerome.

One of the solution would be to create a interpreted_data property to fabio images.

# reach the corrected image according to the metadata
data = img.interpreted_data

# reach the raw data (no changes from the current API)
data = img.data

But yet, we do not plan to apply this change. And we still have to find real acquired data using it.

@jonwright
Copy link
Collaborator Author

jonwright commented Jun 14, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants