diff --git a/+ebsd/@map/importCRCfile.m b/+ebsd/@map/importCRCfile.m index 1ad761a..9946a97 100644 --- a/+ebsd/@map/importCRCfile.m +++ b/+ebsd/@map/importCRCfile.m @@ -50,11 +50,14 @@ data.xStepSize = str2double(datatable(datatable.Parameters=="GridDistX",2).Values); data.yStepSize = str2double(datatable(datatable.Parameters=="GridDistY",2).Values); data.stepsize = str2double(datatable(datatable.Parameters=="GridDist",2).Values); +<<<<<<< HEAD if isempty(data.stepsize) & ~isempty(data.xStepSize) data.stepsize = data.xStepSize; else warning('Step size was not found.') end +======= +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 euler1 = str2double(datatable(datatable.Parameters=="Euler1",2).Values); euler2 = str2double(datatable(datatable.Parameters=="Euler2",2).Values); euler3 = str2double(datatable(datatable.Parameters=="Euler3",2).Values); diff --git a/+ebsd/@map/importebsdmap.m b/+ebsd/@map/importebsdmap.m index 4e47b8a..21ad12f 100644 --- a/+ebsd/@map/importebsdmap.m +++ b/+ebsd/@map/importebsdmap.m @@ -1,4 +1,8 @@ +<<<<<<< HEAD function [emap,grains] = importebsdmap +======= +function [emap,grains] = importebsdmap(dotsfile, grainfile, crcfile) +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 % IMPORTEBSDMAP import EBSD data from two input files. % dotsfile --- HKL EBSD data for each pixels and their corresponding grain ID % grainfile --- HKL data for each grains @@ -12,6 +16,7 @@ % % This function compile a standard workflow to generate a % ebsd.map. +<<<<<<< HEAD typesSupported = {"AztecCrystal", "HKL Channel 5", "Customized"}; [whichtype,tf] = listdlg("PromptString","Select EBSD data type", 'ListString', typesSupported, 'SelectionMode', 'single', 'ListSize', [150,100]); @@ -80,17 +85,67 @@ disp('PIXCELL data have been assigned to each grains. I am polygonizing grains, which may take a while...'); grains.polygonize(dots,ebsdpara); disp('Grains have been polygonized and I am creating ebsd.map...') +======= + + if nargin == 0 + [crcfilename,crcfilepath] = uigetfile('*.cpr', 'Select HKL project file'); + crcfile = [crcfilepath, crcfilename]; + [dotfilename,dotfilepath] = uigetfile('*.txt','Select the exported pixel data file'); + dotsfile = [dotfilepath, dotfilename]; + [grfilename,grfilepath] = uigetfile('*.txt','Select the exported grain data file'); + grainfile = [grfilepath, grfilename]; + whattype = input('Is it an AZtec or HKL file? Type 0 or 1: \n [0] -- AZtec, \n [1] -- HKL \n '); + if isempty(whattype) + isAztec = true; + elseif whattype == 0 + isAztec = ~whattype; + else + isAztec = false; + end + end + disp('Please waiting when the EBSDMAP is being created, if you have already EBSDGRAIN data, use ebsdmap(grainobj) to create the map'); +% h = waitbar(0, msgstart); +% disp(['Start creating ebsd.map. ', msgstart]); +% if nargin == 3 +% dots = ebsd.pixcell.importHKL(dotsfile, stepsize); +% else +% dots = ebsd.pixcell.importHKL(dotsfile); +% end + ebsdpara = ebsd.map.importCRCfile(crcfile); + stepsize = ebsdpara.xStepSize; + if isAztec + dots = ebsd.pixcell.importAZTec(dotsfile, stepsize); + else + dots = ebsd.pixcell.importHKL(dotsfile, stepsize); + end + disp('EBSDDOT data created'); + if isAztec + grains = ebsd.grain.importAztexGrains(grainfile); + else + grains = ebsd.grain.importHKLgrains(grainfile); + end + disp('grain data has been imported, assigning EBSDDOT data to each grains...'); + grains.claimownership(dots); + disp('EBSDDOT data have been assigned to each grains. I am polygonizing grains, which may take a while...'); + grains.polygonize(dots,ebsdpara); + disp('Grains have been polygonized and I am creating EBSDMAP...') +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 emap = ebsd.map(grains); emap.pixels = dots; emap.stepsize = stepsize; emap.numXCells = ebsdpara.numXCells; emap.numYCells = ebsdpara.numYCells; +<<<<<<< HEAD if isfield(ebsdpara, 'allEBSDinfo') emap.ebsdInfoTable = ebsdpara.allEBSDinfo; end if isfield(ebsdpara,'CS1toCS0') emap.CS1toCS0 = ebsdpara.CS1toCS0; end +======= + emap.ebsdInfoTable = ebsdpara.allEBSDinfo; + emap.CS1toCS0 = ebsdpara.CS1toCS0; +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 disp('EBSD map created. I am checking the neighbours of each grains...'); % d = input('What is the buffersize for checking neighbours [default=0.1*stepsize]: '); % if isempty(d) diff --git a/+ebsd/pixcell.m b/+ebsd/pixcell.m index c53df19..b6d9054 100644 --- a/+ebsd/pixcell.m +++ b/+ebsd/pixcell.m @@ -19,11 +19,14 @@ isatedge % Boolean, is it on the edge of a scan? isIndexed % Boolean, is it indexed? stepsize % stepsize should be given separately in micron +<<<<<<< HEAD % numXCells % numYCells % xStepSize % yStepSize % CS1toCS0 +======= +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 % btx % x coordinate of the bottom right corner of the polygon % bry % y coordinate of the bottom right corner of the polygon % blx % x coordinate of the bottom left corner of the polygon @@ -34,7 +37,11 @@ end methods +<<<<<<< HEAD function pxc = pixcell(varargin) +======= + function ed = pixcell(varargin) +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 end function ed = crop(ed,inds) @@ -119,6 +126,7 @@ X = num2cell(xdata,2); Y = num2cell(ydata,2); end +<<<<<<< HEAD function para = extractParameters(pxc) % Extract required parameters including step size, number of x @@ -151,6 +159,12 @@ methods(Static) function pxc = importHKL(datafile) +======= + end + + methods(Static) + function pxc = importHKL(datafile,stepsize) +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 % Import the EBSD data file exported from Tango of HKL Channel % software package. See ebsd.map for how to export the text % data file @@ -182,10 +196,13 @@ pxc.bandcontr = dataArray{:,10}; pxc.bs = dataArray{:,11}; pxc.grainID = dataArray{:,12}; +<<<<<<< HEAD % if nargin < 2 % para = pxc.extraParameters; % stepsize = para.stepsize; % end +======= +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 % if nargin < 2 % if step size is not given, determine it from the imported data % ux = unique(ed.x); % uy = unique(ed.y); @@ -212,12 +229,21 @@ % end % end % end +<<<<<<< HEAD % pxc.stepsize = stepsize; % pxc.y = max(pxc.y)+stepsize-pxc.y; fclose(fileID); end function pxc = importAZTec(datafile) +======= + pxc.stepsize = stepsize; + pxc.y = max(pxc.y)+stepsize-pxc.y; + fclose(fileID); + end + + function pxc = importAZTec(datafile,stepsize) +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 % Import the EBSD data file exported from Tango of HKL Channel % software package. See ebsd.map for how to export the text % data file @@ -229,7 +255,11 @@ if nargin < 1 [filename,filepath] = uigetfile('*.txt','Select the pixel data file:'); datafile = [filepath, filename]; +<<<<<<< HEAD % stepsize = input('Step size is [micron]: '); +======= + stepsize = input('Step size is [micron]: '); +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 end % fileID = fopen(datafile,'r'); startRow = 3; @@ -256,6 +286,7 @@ pxc.x = dataArray.X; pxc.y = dataArray.Y; pxc.grainID = dataArray.GrainID; +<<<<<<< HEAD % if nargin < 2 % para = pxc.extraParameters; % stepsize = para.stepsize; @@ -266,6 +297,40 @@ end function pxc = importCustomized(pixeldatafile) +======= +% if nargin < 2 % if step size is not given, determine it from the imported data +% ux = unique(ed.x); +% uy = unique(ed.y); +% uxdif = diff(ux); +% uydif = diff(uy); +% [xsteps, inxsteps, induxdif] = unique(uxdif); +% [ysteps, inysteps, induydif] = unique(uydif); +% +% xstep = min(unique(uxdif)); +% ystep = min(unique(uydif)); +% if xstep == ystep && xstep ~= 0 +% stepsize = xstep; +% else +% % If the step size cannot be determined from the data, +% % The user is asked to input it (in micron) +% % If no input is returned, step size is set to 10. +% xsteps +% ysteps +% step = input('I cannot determine what the step size is, please tell me... [micron]: '); +% if ~isempty(step) +% stepsize = step; +% else +% error('Step size is not given!'); +% end +% end +% end + pxc.stepsize = stepsize; + pxc.y = max(pxc.y)+stepsize-pxc.y; +% fclose(fileID); + end + + function pxc = importCustomized(pixeldatafile,stepsize) +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 % Import customised EBSD data % The required data include % All pixels at least containing @@ -290,8 +355,13 @@ [filename,filepath] = uigetfile('*.txt','Select the customised pixel data file:'); pixeldatafile = [filepath, filename]; options.Interpreter = 'tex'; +<<<<<<< HEAD % stepsizeanswer = inputdlg('Enter step size \mum:','Step size',[1,30], {''}, options); % stepsize = str2double(stepsizeanswer); +======= + stepsizeanswer = inputdlg('Enter step size \mum:','Step size',[1,30], {''}, options); + stepsize = str2double(stepsizeanswer); +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 end %% Set up the Import Options and import the data opts = delimitedTextImportOptions("NumVariables", 4); @@ -315,7 +385,11 @@ pxc.x = pixeltable.X; pxc.y = pixeltable.Y; pxc.grainID = pixeltable.GrainID; +<<<<<<< HEAD % pxc.stepsize = stepsize; +======= + pxc.stepsize = stepsize; +>>>>>>> 5eec6960b06bb6b3768e8d9e84668357651cc221 end end end