Skip to content

Commit 279f943

Browse files
committed
Add the ability to define multiple ROIs to generate a local bulk composition.
1 parent c9ffe96 commit 279f943

File tree

3 files changed

+89
-43
lines changed

3 files changed

+89
-43
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Note that the public compiled version of XMapTools 4.4 runs natively on Apple Si
1515
- Add the Border Removing Correction (BRC) algorithm from XMapTools 3.4 to the data visualisation module. If checked, the border pixels of the selected mask file will be filtered out.
1616
- Add a new structural formula calculation method for biotite based on Waters & Charnley (2002) assuming an 11 oxygen + Ti basis to account for a deprotonation substitution (added by P. Hartmeier).
1717
- Add a tool to duplicate and adjust the minimum and maximum total values of a set of merged maps (available from the Edit > Map > Duplicate and Adjust menu). This tool allows the user to define a minimum, maximum and sigma value and to rescale all pixels whose sum exceeds this value. It can be used to eliminate some of the artefacts of the EPMA multi-phase calibration routine, especially for mixed pixels that end up with too high totals.
18+
- Add the ability to define multiple ROIs to generate a local bulk composition.
1819
- Add an option to export a merged dataset to text files (available from the Edit > Dataset > Export (Merged) menu).
1920
- Add an option to convert quanti and merged maps from oxide wt% to oxide moles. These datasets can be used in the data visualisation module.
2021
- Add an option to duplicate a training set.

Program/SourceControl/XMapTools_exported.m

Lines changed: 88 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
Calibrate_Merge matlab.ui.control.Button
123123
Calibrate_AddROIforLBC matlab.ui.control.Button
124124
Calibrate_ROI_menu matlab.ui.control.DropDown
125+
Calibrate_MultiROICheckBox matlab.ui.control.CheckBox
125126
CalibratetTab_help matlab.ui.control.Button
126127
Image_15 matlab.ui.control.Image
127128
Image_16 matlab.ui.control.Image
@@ -140,6 +141,7 @@
140141
Calibrate_LOD_CalcButton matlab.ui.control.Button
141142
Calibrate_LOD_menu matlab.ui.control.DropDown
142143
Calibrate_ApplyLODfilter matlab.ui.control.Button
144+
POINTCOUNTINGLabel matlab.ui.control.Label
143145
FUNCTIONSTab matlab.ui.container.Tab
144146
GridLayout_ExternalFctTab matlab.ui.container.GridLayout
145147
NORMALIZATIONSTRUCTURALFORMULALabel matlab.ui.control.Label
@@ -295,8 +297,8 @@
295297
Sampling_SelectStripeButton matlab.ui.control.Button
296298
Sampling_ExportButton matlab.ui.control.Button
297299
Sampling_ResetButton matlab.ui.control.Button
298-
Sampling_Plot1 matlab.ui.control.UIAxes
299300
Sampling_Plot2 matlab.ui.control.UIAxes
301+
Sampling_Plot1 matlab.ui.control.UIAxes
300302
StandardsTab matlab.ui.container.Tab
301303
GridLayout9_3 matlab.ui.container.GridLayout
302304
SubTabStandard matlab.ui.container.TabGroup
@@ -320,8 +322,8 @@
320322
Std_Shift_Y matlab.ui.control.NumericEditField
321323
StdAll_Synchronize matlab.ui.control.Button
322324
StdAll_profil matlab.ui.control.UIAxes
323-
StdAll_map2 matlab.ui.control.UIAxes
324325
StdAll_map1 matlab.ui.control.UIAxes
326+
StdAll_map2 matlab.ui.control.UIAxes
325327
CompositionTab matlab.ui.container.Tab
326328
GridLayout9_4 matlab.ui.container.GridLayout
327329
CompViewer_DensityMenu matlab.ui.control.DropDown
@@ -6687,15 +6689,23 @@ function Standard_ApplyXYShift(app,X,Y)
66876689
end
66886690

66896691

6690-
function LBC_ROI_changed_shape(app,~)
6692+
function LBC_ROI_changed_shape(app, ~)
66916693

66926694
WhereDensity = app.CompViewer_DensityMenu.UserData(app.CompViewer_DensityMenu.Value);
66936695
DensityMap = app.XMapToolsData.MapData.Ot.Data(WhereDensity).Map;
66946696

66956697
NodeData = app.TreeData_Main.SelectedNodes.NodeData;
66966698
Idx = NodeData(2);
66976699

6698-
Mask = createMask(app.ROI_LBC);
6700+
Mask = zeros(size(DensityMap));
6701+
for i = 1:length(app.ROI_LBC)
6702+
MaskTemp = createMask(app.ROI_LBC(i).ROI);
6703+
WhereMask = find(MaskTemp);
6704+
Mask(WhereMask) = 1;
6705+
end
6706+
6707+
% figure, imagesc(Mask), axis image, colorbar
6708+
66996709
IdxMask = find(Mask & app.XMapToolsData.MapData.Me.Data(Idx).CData(end).Map > 0);
67006710

67016711
DensityDomain = sum(DensityMap(IdxMask))/numel(IdxMask);
@@ -13383,6 +13393,15 @@ function Calibrate_GenerateDensityButtonPushed(app, event)
1338313393

1338413394
end
1338513395

13396+
% Value changed function: Calibrate_MultiROICheckBox
13397+
function Calibrate_MultiROICheckBoxValueChanged(app, event)
13398+
if isequal(app.Calibrate_MultiROICheckBox.Value,0)
13399+
app.ROI_LBC = [];
13400+
app.ROI_LBC_Listener = [];
13401+
ROI_DeleteROI(app);
13402+
end
13403+
end
13404+
1338613405
% Button pushed function: Calibrate_AddROIforLBC
1338713406
function Calibrate_AddROIforLBCButtonPushed(app, event)
1338813407

@@ -13407,29 +13426,41 @@ function Calibrate_AddROIforLBCButtonPushed(app, event)
1340713426

1340813427
app.CompViewer_Label.Text = 'Local bulk composition';
1340913428

13410-
ROI_DeleteROI(app);
13429+
if isequal(app.Calibrate_MultiROICheckBox,0)
13430+
ROI_DeleteROI(app);
13431+
app.ROI_LBC = [];
13432+
app.ROI_LBC_Listener = [];
13433+
iROI = 1;
13434+
else
13435+
iROI = length(app.ROI_LBC) + 1;
13436+
end
1341113437

1341213438
switch app.Calibrate_ROI_menu.Value
1341313439
case 'Rectangle ROI'
1341413440
DrawingMode(app,'on','Rectangle');
13415-
app.ROI_LBC = drawrectangle(app.FigMain,'Color',[0.57,0.00,0.69],'InteractionsAllowed','all');
13441+
app.ROI_LBC(iROI).ROI = drawrectangle(app.FigMain,'Color',[0.57,0.00,0.69],'InteractionsAllowed','all');
1341613442
DrawingMode(app,'off');
1341713443

1341813444
case 'Polygon ROI'
1341913445
DrawingMode(app,'on','Polygon');
13420-
app.ROI_LBC = drawpolygon(app.FigMain,'Color',[0.57,0.00,0.69],'InteractionsAllowed','all');
13446+
app.ROI_LBC(iROI).ROI = drawpolygon(app.FigMain,'Color',[0.57,0.00,0.69],'InteractionsAllowed','all');
1342113447
DrawingMode(app,'off');
1342213448
end
1342313449

13424-
app.ROI_LBC_Listener = addlistener(app.ROI_LBC, 'ROIMoved', @(varargin)LBC_ROI_changed_shape(app, app.ROI_LBC));
13450+
app.ROI_LBC_Listener = addlistener(app.ROI_LBC(iROI).ROI, 'ROIMoved', @(varargin)LBC_ROI_changed_shape(app, app.ROI_LBC));
1342513451

1342613452
% Extract data
13427-
LBC_ROI_changed_shape(app,app.ROI_LBC);
13453+
LBC_ROI_changed_shape(app, app.ROI_LBC);
1342813454

1342913455
app.TabGroup.SelectedTab = app.CompositionTab;
1343013456

1343113457
end
1343213458

13459+
% Button pushed function: Calibrate_Spider_Button
13460+
function Calibrate_Spider_ButtonPushed(app, event)
13461+
Menu_Modules_SpiderPlotMenuSelected(app, event);
13462+
end
13463+
1343313464
% Button pushed function: Calibrate_Merge
1343413465
function Calibrate_MergeButtonPushed(app, event)
1343513466

@@ -13777,11 +13808,6 @@ function LBC_UncCalcButtonPushed(app, event)
1377713808

1377813809
end
1377913810

13780-
% Button pushed function: Calibrate_Spider_Button
13781-
function Calibrate_Spider_ButtonPushed(app, event)
13782-
Menu_Modules_SpiderPlotMenuSelected(app, event);
13783-
end
13784-
1378513811
% Callback function: Help_ProjectImportMenu, ImportTab_help
1378613812
function Help_ImportTab_helpButtonPushed(app, event)
1378713813

@@ -16858,7 +16884,7 @@ function createComponents(app)
1685816884

1685916885
% Create CalibrateGridLayout
1686016886
app.CalibrateGridLayout = uigridlayout(app.CALIBRATETab);
16861-
app.CalibrateGridLayout.ColumnWidth = {'1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '0.15x'};
16887+
app.CalibrateGridLayout.ColumnWidth = {'1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x', '0.3x', '1x', '0.15x'};
1686216888
app.CalibrateGridLayout.RowHeight = {'1x', '1x', '1x', '0.6x'};
1686316889
app.CalibrateGridLayout.ColumnSpacing = 4;
1686416890
app.CalibrateGridLayout.RowSpacing = 4;
@@ -16942,7 +16968,7 @@ function createComponents(app)
1694216968
app.LOCALBULKCOMPOSITIONLabel.FontSize = 9;
1694316969
app.LOCALBULKCOMPOSITIONLabel.FontColor = [0.149 0.149 0.149];
1694416970
app.LOCALBULKCOMPOSITIONLabel.Layout.Row = 4;
16945-
app.LOCALBULKCOMPOSITIONLabel.Layout.Column = [12 19];
16971+
app.LOCALBULKCOMPOSITIONLabel.Layout.Column = [12 21];
1694616972
app.LOCALBULKCOMPOSITIONLabel.Text = 'LOCAL BULK COMPOSITION';
1694716973

1694816974
% Create Calibrate_GenerateDensity
@@ -16975,18 +17001,27 @@ function createComponents(app)
1697517001
app.Calibrate_AddROIforLBC.FontSize = 9;
1697617002
app.Calibrate_AddROIforLBC.Tooltip = {'Add ROI for LBC extraction'};
1697717003
app.Calibrate_AddROIforLBC.Layout.Row = [1 2];
16978-
app.Calibrate_AddROIforLBC.Layout.Column = [18 19];
17004+
app.Calibrate_AddROIforLBC.Layout.Column = [20 21];
1697917005
app.Calibrate_AddROIforLBC.Text = 'Add ROI';
1698017006

1698117007
% Create Calibrate_ROI_menu
1698217008
app.Calibrate_ROI_menu = uidropdown(app.CalibrateGridLayout);
1698317009
app.Calibrate_ROI_menu.Items = {'Rectangle ROI', 'Polygon ROI'};
1698417010
app.Calibrate_ROI_menu.Tooltip = {'Method for ROI drawing'};
1698517011
app.Calibrate_ROI_menu.FontSize = 10;
16986-
app.Calibrate_ROI_menu.Layout.Row = 3;
17012+
app.Calibrate_ROI_menu.Layout.Row = 1;
1698717013
app.Calibrate_ROI_menu.Layout.Column = [16 19];
1698817014
app.Calibrate_ROI_menu.Value = 'Rectangle ROI';
1698917015

17016+
% Create Calibrate_MultiROICheckBox
17017+
app.Calibrate_MultiROICheckBox = uicheckbox(app.CalibrateGridLayout);
17018+
app.Calibrate_MultiROICheckBox.ValueChangedFcn = createCallbackFcn(app, @Calibrate_MultiROICheckBoxValueChanged, true);
17019+
app.Calibrate_MultiROICheckBox.Tooltip = {'Activate Mutli-ROI mode'};
17020+
app.Calibrate_MultiROICheckBox.Text = 'Multi-ROI';
17021+
app.Calibrate_MultiROICheckBox.FontSize = 9;
17022+
app.Calibrate_MultiROICheckBox.Layout.Row = 2;
17023+
app.Calibrate_MultiROICheckBox.Layout.Column = [17 19];
17024+
1699017025
% Create CalibratetTab_help
1699117026
app.CalibratetTab_help = uibutton(app.CalibrateGridLayout, 'push');
1699217027
app.CalibratetTab_help.ButtonPushedFcn = createCallbackFcn(app, @Help_CalibratetTab_helpButtonPushed, true);
@@ -17011,7 +17046,7 @@ function createComponents(app)
1701117046
% Create Image_17
1701217047
app.Image_17 = uiimage(app.CalibrateGridLayout);
1701317048
app.Image_17.Layout.Row = [1 4];
17014-
app.Image_17.Layout.Column = 23;
17049+
app.Image_17.Layout.Column = 22;
1701517050
app.Image_17.ImageSource = 'ImageDelimiter.png';
1701617051

1701717052
% Create Image_18
@@ -17076,15 +17111,15 @@ function createComponents(app)
1707617111
app.LBC_UncCalc.IconAlignment = 'center';
1707717112
app.LBC_UncCalc.Tooltip = {'Calculate Uncertainties using Monte Carlo'};
1707817113
app.LBC_UncCalc.Layout.Row = 2;
17079-
app.LBC_UncCalc.Layout.Column = 22;
17114+
app.LBC_UncCalc.Layout.Column = 26;
1708017115
app.LBC_UncCalc.Text = '';
1708117116

1708217117
% Create PxLabel
1708317118
app.PxLabel = uilabel(app.CalibrateGridLayout);
1708417119
app.PxLabel.HorizontalAlignment = 'right';
17085-
app.PxLabel.FontSize = 8;
17120+
app.PxLabel.FontSize = 9;
1708617121
app.PxLabel.Layout.Row = 2;
17087-
app.PxLabel.Layout.Column = 20;
17122+
app.PxLabel.Layout.Column = [23 24];
1708817123
app.PxLabel.Text = 'Px';
1708917124

1709017125
% Create LBC_ValueMC
@@ -17095,7 +17130,7 @@ function createComponents(app)
1709517130
app.LBC_ValueMC.HorizontalAlignment = 'center';
1709617131
app.LBC_ValueMC.FontSize = 10;
1709717132
app.LBC_ValueMC.Layout.Row = 2;
17098-
app.LBC_ValueMC.Layout.Column = 21;
17133+
app.LBC_ValueMC.Layout.Column = 25;
1709917134
app.LBC_ValueMC.Value = 20;
1710017135

1710117136
% Create LBC_NbSimMC
@@ -17106,15 +17141,15 @@ function createComponents(app)
1710617141
app.LBC_NbSimMC.HorizontalAlignment = 'center';
1710717142
app.LBC_NbSimMC.FontSize = 10;
1710817143
app.LBC_NbSimMC.Layout.Row = 1;
17109-
app.LBC_NbSimMC.Layout.Column = [21 22];
17144+
app.LBC_NbSimMC.Layout.Column = [25 26];
1711017145
app.LBC_NbSimMC.Value = 100;
1711117146

1711217147
% Create SimLabel
1711317148
app.SimLabel = uilabel(app.CalibrateGridLayout);
1711417149
app.SimLabel.HorizontalAlignment = 'right';
17115-
app.SimLabel.FontSize = 8;
17150+
app.SimLabel.FontSize = 9;
1711617151
app.SimLabel.Layout.Row = 1;
17117-
app.SimLabel.Layout.Column = 20;
17152+
app.SimLabel.Layout.Column = [23 24];
1711817153
app.SimLabel.Text = 'Sim';
1711917154

1712017155
% Create Calibrate_LOD_CalcButton
@@ -17146,6 +17181,16 @@ function createComponents(app)
1714617181
app.Calibrate_ApplyLODfilter.Layout.Column = 33;
1714717182
app.Calibrate_ApplyLODfilter.Text = '';
1714817183

17184+
% Create POINTCOUNTINGLabel
17185+
app.POINTCOUNTINGLabel = uilabel(app.CalibrateGridLayout);
17186+
app.POINTCOUNTINGLabel.HorizontalAlignment = 'center';
17187+
app.POINTCOUNTINGLabel.VerticalAlignment = 'bottom';
17188+
app.POINTCOUNTINGLabel.FontSize = 9;
17189+
app.POINTCOUNTINGLabel.FontColor = [0.149 0.149 0.149];
17190+
app.POINTCOUNTINGLabel.Layout.Row = 4;
17191+
app.POINTCOUNTINGLabel.Layout.Column = [23 27];
17192+
app.POINTCOUNTINGLabel.Text = 'POINT COUNTING';
17193+
1714917194
% Create FUNCTIONSTab
1715017195
app.FUNCTIONSTab = uitab(app.TabButtonGroup);
1715117196
app.FUNCTIONSTab.AutoResizeChildren = 'off';
@@ -18455,20 +18500,20 @@ function createComponents(app)
1845518500
app.Sampling_ResetButton.Layout.Column = 7;
1845618501
app.Sampling_ResetButton.Text = '';
1845718502

18458-
% Create Sampling_Plot1
18459-
app.Sampling_Plot1 = uiaxes(app.GridLayout9_2);
18460-
app.Sampling_Plot1.PlotBoxAspectRatio = [1.02534562211982 1 1];
18461-
app.Sampling_Plot1.FontSize = 9;
18462-
app.Sampling_Plot1.Layout.Row = [3 10];
18463-
app.Sampling_Plot1.Layout.Column = [1 7];
18464-
1846518503
% Create Sampling_Plot2
1846618504
app.Sampling_Plot2 = uiaxes(app.GridLayout9_2);
1846718505
app.Sampling_Plot2.PlotBoxAspectRatio = [1.02534562211982 1 1];
1846818506
app.Sampling_Plot2.FontSize = 9;
1846918507
app.Sampling_Plot2.Layout.Row = [12 19];
1847018508
app.Sampling_Plot2.Layout.Column = [1 7];
1847118509

18510+
% Create Sampling_Plot1
18511+
app.Sampling_Plot1 = uiaxes(app.GridLayout9_2);
18512+
app.Sampling_Plot1.PlotBoxAspectRatio = [1.02534562211982 1 1];
18513+
app.Sampling_Plot1.FontSize = 9;
18514+
app.Sampling_Plot1.Layout.Row = [3 10];
18515+
app.Sampling_Plot1.Layout.Column = [1 7];
18516+
1847218517
% Create StandardsTab
1847318518
app.StandardsTab = uitab(app.TabGroup);
1847418519
app.StandardsTab.Title = 'Standards';
@@ -18649,16 +18694,6 @@ function createComponents(app)
1864918694
app.StdAll_profil.Layout.Row = [1 3];
1865018695
app.StdAll_profil.Layout.Column = [1 2];
1865118696

18652-
% Create StdAll_map2
18653-
app.StdAll_map2 = uiaxes(app.GridLayout11);
18654-
title(app.StdAll_map2, 'sqrt(sum(corrcoef^2))')
18655-
app.StdAll_map2.Toolbar.Visible = 'off';
18656-
app.StdAll_map2.PlotBoxAspectRatio = [1.39236111111111 1 1];
18657-
app.StdAll_map2.FontSize = 9;
18658-
app.StdAll_map2.Box = 'on';
18659-
app.StdAll_map2.Layout.Row = [9 12];
18660-
app.StdAll_map2.Layout.Column = [1 2];
18661-
1866218697
% Create StdAll_map1
1866318698
app.StdAll_map1 = uiaxes(app.GridLayout11);
1866418699
title(app.StdAll_map1, 'Element')
@@ -18669,6 +18704,16 @@ function createComponents(app)
1866918704
app.StdAll_map1.Layout.Row = [5 8];
1867018705
app.StdAll_map1.Layout.Column = [1 2];
1867118706

18707+
% Create StdAll_map2
18708+
app.StdAll_map2 = uiaxes(app.GridLayout11);
18709+
title(app.StdAll_map2, 'sqrt(sum(corrcoef^2))')
18710+
app.StdAll_map2.Toolbar.Visible = 'off';
18711+
app.StdAll_map2.PlotBoxAspectRatio = [1.39236111111111 1 1];
18712+
app.StdAll_map2.FontSize = 9;
18713+
app.StdAll_map2.Box = 'on';
18714+
app.StdAll_map2.Layout.Row = [9 12];
18715+
app.StdAll_map2.Layout.Column = [1 2];
18716+
1867218717
% Create CompositionTab
1867318718
app.CompositionTab = uitab(app.TabGroup);
1867418719
app.CompositionTab.Title = 'Composition';

Program/XMapTools.mlapp

1.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)