Open anastasiavr opened 3 years ago
Unfortunately, not at this time. Newer versions of AZtec can output hdf5 files, but as far as I can tell, they only includes the information and not the patterns themselves. Edax's hdf5 format does include pattern data, and saves a lot of time. Hopefully, AZtec will follow suit someday.
-Tim
On Wed, Feb 10, 2021, 5:23 AM anastasiavr notifications@github.com wrote:
Hello, I am currently using Aztec software for ebsp acquisition, which stores the kikuchi patterns in an .ebsp file. One can then export the patterns in .tiff file types but this is a very very long process. Is there a way open xy can work directly with the .ebsp file instead of the tiffs? Thank you in advance!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BYU-MicrostructureOfMaterials/OpenXY/issues/24, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWHJDKCN5D3CAPNGTXNLSLS6J3EVANCNFSM4XM3MQ6A .
Hi, just to add that it is possible to read uncompressed .ebsp files. I wrote some code to read them in EMsoft a few years back (EMsoft-org/EMsoft@ef30487abfd14e825370ad73bc41afc215719f0a EMsoft-org/EMsoft@c3bce54af0a45fd50f4fca5a8fffc2f96d826af0) because I was having a similar nightmare with 100,000+ files in a single directory.
Let me know if you want to implement this here, I haven't coded in matlab in a good while but I can run you through the structure of an .ebsp file.
Hello, I took some time to look at your codes, but unfortunately I am not familiar with Fortran. I am using MATLAB for some time now (I definitely am not an expert) but I think understanding the structure of the .ebsp files would be very useful as a first step and interesting for other users as well. Thank you for taking the time to help.
Mike is going to help us figure out the structure, so hopefully we'll have a go at it in the near future...
anastasiavr - do you have small scan with the relevant .cpr/.crc/.ctf/.ebsp files that we could use to develop this capability? If so, email me on dfullwood@byu.edu. Mike has sent us some python code to help with this. Thanks David
@dtfullwood Yes, I will have a look for a small scan, otherwise I will have to compress a larger one. I will get back you via email. Thank you! Anastasia
Mike has sent us some python code to help with this.
@mikesmic, could you share this Python code with me (hakon.w.anes@ntnu.no) as well? We would like to read from and write to .ebsp files in the kikuchipy Python package. We can read and write some formats, but would like to expand our IO capabilities.
I just sent you some matlab code that will read an image from an .EBSP file. it is just rough code for playing with but has the essential information:
% Read EBSP file [file,path]=uigetfile; ftoopen=fopen([path,file]); fseek(ftoopen,8,'bof'); %move to start of offset data xCells=37; %number of points in x direction from .cpr or .crc file – need to automate this yCells=40; Offset=fread(ftoopen,xCellsyCells,'uint64'); % start point of each pattern in file Offset=reshape(Offset,[yCells,xCells]); % I’m not 100% sure about the order here – need to check against OpenXY i=1; %pick number of pattern desired in y direction j=1; %pick number of pattern desired in x direction fseek(ftoopen,Offset(i,j),'bof'); patdims=fread(ftoopen,8,'uint16'); patdims=[patdims(5),patdims(3)]; % size of EBSP patsize=patdims(1)patdims(2); pat=fread(ftoopen,patsize,'uint8'); pat=reshape(pat,patdims); imagesc(pat) colormap gray fclose(ftopen);
Here is the original python code, but the pattern dimension and scan size are hard coded in. The matlab code shows how to read the pattern dimensions; and scan size (xCells, yCells) can be read from the .crc or .cpr file very easily (note that github reads the comment symbol '#' as a header command and bolds the line...):
import numpy as np import matplotlib.pyplot as plt
def load_pat(offset, pat_file, pat_dims): """Read a single EBSD pattern image from file.
Parameters
----------
offset: int
Position of the start of the pattern block.
pat_file: str
Path to the .ebsp file.
pat_dims : tuple of int
Dimensions of the pattern image.
Returns
-------
np.ndarray
Loaded pattern image
"""
pat = np.fromfile(
pat_file,
offset=offset + 16,
count=pat_dims[0] * pat_dims[1],
dtype=np.uint8
).reshape(pat_dims)
return pat
pat_file = "7aafe81e-f69a-4ec8-b952-e4df78f04d7d.ebsp"
map_dims = (70, 70) pat_dims = (512, 622)
pat_offsets = np.fromfile( pat_file, offset=8, count=map_dims[0] * map_dims[1], dtype=np.int64 ).reshape(map_dims)
pat = load_pat(pat_offsets[0, 0], pat_file, pat_dims)
plt.figure() plt.imshow(pat)
Thanks a lot @dtfullwood (and @mikesmic?)!
Thanks for sharing that on! @hakonanes looks like a very nice package, I can see that being very useful
Hello, I am currently using Aztec software for ebsp acquisition, which stores the kikuchi patterns in an .ebsp file. One can then export the patterns in .tiff file types but this is a very very long process. Is there a way open xy can work directly with the .ebsp file instead of the tiffs? Thank you in advance!