George-R-Heath / NanoLocz

Atomic Force Microscopy Analysis Platform
https://george-r-heath.github.io/NanoLocz/
GNU General Public License v3.0
20 stars 9 forks source link

Support for non-square aspect ratios #11

Open k-haru opened 1 year ago

k-haru commented 1 year ago

Hi NanoLocz team,

In v1.02, images appear distorted when different sampling frequencies are used in the xy axis. It might be easy to use the information in the asd header, but I don't know anything about Matlab, so I can't handle this error. Do you know which files to tweak?

Best regards

George-R-Heath commented 1 year ago

Hi K-haru,

It may be possible to fix this by using the 'force to 1:1' button found to the right of the video playback controls which will force the video to be square using bicubic interpolation. Alternatively there is the view as 1:1 which doesn't change the image just the view.

However if this is not working it may be an issue with the asd file opener, if the above doesn't work would it be possible to send me an example asd file which is having problems ( to g.r.heath@leeds.ac.uk).

Thanks for highlighting this issue, please do get in contact with any other issues also.

Many thanks, George

k-haru commented 1 year ago

Thanks for the quick reply.

Indeed, the 'force to 1:1' button works well, but it crips out to square (my data is not square pixel size; i.e. xPixel=240, yPixel=96, xScanRange=120, yScanRange=96). And downstream processes like averaging will also produce distorted images.

Unrelated to this, the histogram values do not seem to match those of the analysis software produced in Kanazawa. Even the ASD files in Example Data are calculated unusual heights. I guess the length of offsets are 16 bytes, maybe. If necessary, I will create an issue. https://github.com/George-R-Heath/NanoLocz/blob/04fbb07d7544a09f60961676bae65eec96750d0c/scripts/read_asd.m#L48 I'm a bit pressed for time at the moment, so I'll report back if I notice any more problems.

George-R-Heath commented 1 year ago

Hi k-haru,

Sorry for the delay, I will contact the person that wrote the asd opener to modify as I can't seem to correct it yet. For now I have added a image resize option in the latest update. This is somewhat manual so not ideal for high-throughput however, in the new version, go to the 'Image' dropdown menu at the top of the app and open 'Resize/Rotate' this will allow you to change pixels in x and y as well as scale the height (multiply) if you know by what factor the height needs changing. I will try to update the asd opener so this is automatic and correct height in the future.

Many thanks, George

k-haru commented 1 year ago

Thanks a lot! Now it works well.

For your information, there is well-writen ASD opener and suggesting the 16 byte offsets. https://github.com/ToruNiina/libasd/blob/b7b051f3f7598815c6a6f0d2f5f9dac27068a870/libasd/read_header.hpp#L124C1-L125C47 And I verified my ASD opener implemented in Julia with kanazawa's software. https://github.com/k-haru/ASD.jl