Skip to content

Commit

Permalink
Merge branch 'develop' into 4pi
Browse files Browse the repository at this point in the history
  • Loading branch information
jries committed Apr 6, 2022
2 parents c8ac70a + 30612c2 commit 46c5152
Show file tree
Hide file tree
Showing 27 changed files with 363 additions and 115 deletions.
7 changes: 5 additions & 2 deletions +gui/GuiMainSMAP.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,16 @@ function makeGui(obj)

gfile=obj.getGlobalSetting('guiPluginConfigFile');
if ~exist(gfile,'file')
gfile=strrep(gfile,'settings', settingsdir);
ind = strfind(gfile,'settings');
gfile=[settingsdir gfile(ind+8:end)];
% gfile=strrep(gfile,'settings', settingsdir);
end

if exist(gfile,'file')
guimodules=readstruct(gfile,[],true);
else
guimodules=pmenu;
% guimodules=pmenu;
guimodules=struct('File',[],'Analyze',[],'Process',[],'ROIManager',[]);
end
guimodulespure=myrmfield(guimodules,{'GuiParameters','globalGuiState'});
obj.setPar('guimodules',guimodulespure);
Expand Down
5 changes: 4 additions & 1 deletion +gui/SEExploreGui.m
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,10 @@ function keypress(a,event,obj,flag)
removecell_callback(0,0,obj);
else
removesite_callback(0,0,obj);
end
end
case 'slash'
toggleuse_callback(0,0,obj)

end

end
Expand Down
6 changes: 5 additions & 1 deletion +interfaces/SEEvaluationProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ function redraw(obj)
parameters(inds:inds+1)=[];
end

if ~isempty(obj.site.image)
sx=obj.site.image.rangex;
fovsize=(sx(2)-sx(1))*1000*[1,1];
fovsize=(sx(2)-sx(1))*1000*[1,1];
else
fovsize=obj.getPar('se_sitefov')*[1,1];
end
if isempty(p.position) %no position specified, that is the usual case

pos=obj.site.pos;
Expand Down
15 changes: 14 additions & 1 deletion +interfaces/SiteExplorer.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,20 @@ function addFile(obj,name,ID,info)

%plot all site boxes
if obj.locData.getPar('se_drawboxes')&&~isempty(obj.sites)&&~isempty(obj.sites(1).info)
allsites=[obj.sites(:).info];
try
allsites=[obj.sites(:).info];
catch err %fix connected sites
err
disp('fixing connected sites')
for k=1:length(obj.sites)
if ~isfield(obj.sites(k).info,'connectedsites')
obj.sites(k).info.connectedsites=[];
end
end

allsites=[obj.sites(:).info];
end

ind=[allsites.cell]==cell.ID;

if sum(ind)>0
Expand Down
5 changes: 4 additions & 1 deletion LocMoFit/@LocMoFit/rotCoordNMkImg.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@
imageo = drawerSMAP(imageo,p_render);
end
thisImg = imageo.image;
v = v + thisImg;

if ~isempty(thisImg) % XXXX added by Jonas
v = v + thisImg;
end
end
end
imagesc(ax, v);
Expand Down
41 changes: 10 additions & 31 deletions LocMoFit/@LocMoFit/transModPoint.m
Original file line number Diff line number Diff line change
@@ -1,40 +1,19 @@
function modPoint = transModPoint(obj, modPoint, varargin)
function modPoint = transModPoint(obj, modPoint)
% l stands for layer.
% Variation is now controled by SMAP as linkage error

p = inputParser;
p.addParameter('lPars',[]);
p.parse(varargin{:});
p = p.Results;
%% Transform the model
if isempty(p.lPars)
lPars = obj.exportPars(1,'lPar');
else
lPars = p.lPars;
end
if iscell(modPoint)
for l = 1:obj.numOfLayer
modPoint_.xnm = modPoint{l}.x; modPoint_.ynm = modPoint{l}.y;
if isfield(modPoint{l}, 'z')
modPoint_.znm = modPoint{l}.z;
end
modPoint_ = obj.locsHandler(modPoint_, lPars,0,'usedformalism', 'rotationMatrixRev','order_transform','RT');

modPoint{l}.x = modPoint_.xnm; modPoint{l}.y = modPoint_.ynm;
if isfield(modPoint{l}, 'z')
modPoint{l}.z = modPoint_.znm;
end
end
else
modPoint_.xnm = modPoint.x; modPoint_.ynm = modPoint.y;
if isfield(modPoint, 'z')
modPoint_.znm = modPoint.z;
lPar = obj.exportPars(1,'lPar');
for l = 1:obj.numOfLayer
modPoint_.xnm = modPoint{l}.x; modPoint_.ynm = modPoint{l}.y;
if isfield(modPoint{l}, 'z')
modPoint_.znm = modPoint{l}.z;
end
modPoint_ = obj.locsHandler(modPoint_, lPars,0,'usedformalism', 'rotationMatrixRev','order_transform','RT');
modPoint_ = obj.locsHandler(modPoint_, lPar,0,'usedformalism', 'rotationMatrixRev','order_transform','RT');

modPoint.x = modPoint_.xnm; modPoint.y = modPoint_.ynm;
if isfield(modPoint, 'z')
modPoint.z = modPoint_.znm;
modPoint{l}.x = modPoint_.xnm; modPoint{l}.y = modPoint_.ynm;
if isfield(modPoint{l}, 'z')
modPoint{l}.z = modPoint_.znm;
end
end
end
2 changes: 1 addition & 1 deletion LocMoFit/helperClass/SMLMModelFit_manager.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Please use LocMoFit_manager instead.
methods
function obj = SMLMModelFit_manager(varargin)
obj@LocMoFit_manager(varargin{:});
obj = LocMoFit_manager(varargin);
end
end
end
3 changes: 3 additions & 0 deletions fit3Dcspline/calibrate3D_GUI_g.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
obj.guihandles.dz=uicontrol('style','edit','String','10','Position',[xpos1+2*xw,top-9*vsep,xw*0.5,fieldheight],'FontSize',fontsize);
obj.guihandles.dz.TooltipString=sprintf('Distance in nm between frames. By convention, these are objective positions (not corrected for refractive index mismatch). \n A spacing between 10 nm and 50 nm works well ');
obj.guihandles.dzt.TooltipString=obj.guihandles.dz.TooltipString;
obj.guihandles.z0focus=uicontrol('style','checkbox','String','focus as z ref','Position',[xpos1+2.5*xw,top-9*vsep,xw*1.5,fieldheight],'FontSize',fontsize);


obj.guihandles.modalityt=uicontrol('style','text','String','3D modality ','Position',[xpos1,top-8*vsep,xw*2,fieldheight],'FontSize',fontsize,'HorizontalAlignment',ha);
obj.guihandles.modality=uicontrol('style','popupmenu','String',{'arbitrary','global 2 channel','4Pi'},'Value',1,'Position',[xpos1+2*xw,top-8*vsep,xw*1.3,fieldheight],'FontSize',fontsize,'Callback',@obj.modality_callback);
Expand Down Expand Up @@ -464,6 +466,7 @@ function selectroi_callback(obj,a,b)
p.filelist=obj.guihandles.filelist.String;
p.outputfile=obj.guihandles.outputfile.String;
p.dz=str2double(obj.guihandles.dz.String);
p.z0focus=obj.guihandles.z0focus.Value;
p.modality=obj.guihandles.modality.String{obj.guihandles.modality.Value};
p.PSF2D=obj.guihandles.PSF2D.Value;
p.zcorr=obj.guihandles.corrzselect.String{obj.guihandles.corrzselect.Value};
Expand Down
3 changes: 2 additions & 1 deletion fit3Dcspline/calibrate_globalworkflow.m
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ function calibrate_globalworkflow(p)
pt.xrange=pp.xrange1+camroi1(1);
pt.yrange=pp.yrange1+camroi1(2);
pt.unit='pixel';
pt.type='projective';
%pt.type='projective'; %old
pt.type=ph.Tform; %use from GUI
transform.setTransform(1,pt)
pt.mirror=pp.mirrorax;

Expand Down
11 changes: 11 additions & 0 deletions fit3Dcspline/private/getfocusPSF.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function z0focus=getfocusPSF(PSF)
for k=1:length(PSF)
[P,CRLB, LL] =mleFit_LM(PSF{k}*10000,4,100,1,0,1);
sx=P(:,5);
sy=P(:,6);
dsx=sx-sy;
[v,ind(k)]=min(dsx.^2);
end
z0focus=round(mean(ind));
end

4 changes: 3 additions & 1 deletion fit3Dcspline/private/getstackcal_g.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@
splinefit.PSFsmooth={single(corrPSFhdr)};
cspline.mirror=0;
end

if p.z0focus
z0reference=getfocusPSF(splinefit.PSFsmooth);
end

cspline.z0=z0reference;%round((b3_0.dataSize(3)+1)/2);
cspline.dz=p.dz;
Expand Down
5 changes: 5 additions & 0 deletions fit3Dcspline/private/getstackcal_gs.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@
cspline.mirror=0;
end

%find focus z position
if p.z0focus
z0reference=getfocusPSF(splinefit.PSFsmooth);
end

cspline.z0=z0reference;%round((b3_0.dataSize(3)+1)/2);
cspline.dz=p.dz;
cspline.x0=dRx+1;
Expand Down
18 changes: 18 additions & 0 deletions other/CallBatchprocessorScript.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SMAP %you need to start SMAP to add directories and set some variables
smapobject=g;

%main batch file:
batchfile='/Volumes/Ries_Data/DataSSD/workingdirectory/GlobalFitPaper/Exampledata/NPC4C/191022_beads/003_beads_10nm_3D_2c_e_676_685_Z-stack_1_batch.mat';
%list of data files:
rawfiles={'/Volumes/Ries_Data/DataSSD/workingdirectory/GlobalFitPaper/Exampledata/NPC4C/191022_beads/001_beads_10nm_3D_2c_e_676_685_Z-stack_1/001_beads_10nm_3D_2c_e_676_685_Z-stack_1_MMStack_Pos0.ome.tif'};

%make batch processor programmatically
bp=WorkflowModules.Batchprocessor;
bp.attachPar(smapobject.P)
bp.makeGui;
bp.guihandles.mainbatchfile.String=batchfile;
bp.guihandles.filelist.String=rawfiles;
bp.guihandles.filelist.Value=1;

%run batch processor:
bp.processb_callback(0,0);
28 changes: 28 additions & 0 deletions plugins/+Analyze/+MINFLUX/MotorPAINT.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
end
for k=1:length(gn)
indh=locs.groupindex==gn(k);

if p.skipfirst>0
outn=find(indh,p.skipfirst,'first');
indh(outn)=false;
end
if sum(indh)<p.minlen
continue
end

x=locs.xnm(indh);
y=locs.ynm(indh);
Expand Down Expand Up @@ -83,16 +91,20 @@
t=tic;
end
end
axis(axall,"ij")
axis(axall,"equal")

[~, filename]=fileparts(obj.locData.files.file(1).name);
obj.locData.addfile(['tracks_s' num2str(p.splitmergestep) '_' num2str(obj.locData.files.filenumberEnd) '_' filename]);
% obj.locData.files.file(end).info.simulationParameters=obj.getGuiParameters;
if p.addtracks
obj.locData.addLocData(locsout);

obj.locData.filter
% try
initGuiAfterLoad(obj);
obj.locData.filter
end

ax=obj.initaxis('tracks');
hold(ax,'off')
Expand All @@ -101,6 +113,9 @@
hold(ax,'on')
end
axis(ax,"equal")
axis(ax,"ij")
ax.XLim=axall.XLim;
ax.YLim=axall.YLim;

axc=obj.initaxis('angle');
cmap=hsv(256);
Expand All @@ -111,6 +126,9 @@
hold(axc,'on')
end
axis(axc,"equal")
axis(axc,"ij")
axc.XLim=axall.XLim;
axc.YLim=axall.YLim;

end
function pard=guidef(obj)
Expand Down Expand Up @@ -165,6 +183,16 @@
pard.stepfunctionm.position=[3,4.];
pard.stepfunctionm.Width=1;

pard.skipfirstt.object=struct('String','Skip first:','Style','text');
pard.skipfirstt.position=[4,1];
pard.skipfirstt.Width=1.5;
pard.skipfirst.object=struct('String','0','Style','edit');
pard.skipfirst.position=[4,2.5];
pard.skipfirst.Width=0.5;

pard.addtracks.object=struct('String','Add tracks','Style','checkbox','Value',1);
pard.addtracks.position=[5,1];
pard.addtracks.Width=2;

pard.plugininfo.description=sprintf('');
pard.plugininfo.type='ProcessorPlugin';
Expand Down
22 changes: 11 additions & 11 deletions plugins/+Analyze/+calibrate/TrainDeepSMLM.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
function pard=guidef(obj)
pard=guidef(obj);
end
function initGui(obj)
[email protected](obj);
obj.jsonfile=obj.jsondefault;
tt=uitable(obj.handle);
tt.Position=obj.guihandles.partablepos.Position;
tt.Position(4)=tt.Position(4)*7;
obj.guihandles.parttable=tt;
jsontxt=fileread(obj.jsondefault);
obj.jsonstruct=jsondecode(jsontxt);
makejsontable(obj);
end
% function initGui(obj)
% [email protected](obj);
% obj.jsonfile=obj.jsondefault;
% tt=uitable(obj.handle);
% tt.Position=obj.guihandles.partablepos.Position;
% tt.Position(4)=tt.Position(4)*7;
% obj.guihandles.parttable=tt;
% jsontxt=fileread(obj.jsondefault);
% obj.jsonstruct=jsondecode(jsontxt);
% makejsontable(obj);
% end

end
end
Expand Down
4 changes: 2 additions & 2 deletions plugins/+Process/+Drift/private/applydriftcorrection.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
poso.xnm(indg&indpos)=pos.xnm(indg&indpos)-drift.xy(1).x(pos.frame(indg&indpos));
poso.xnm(indg&~indpos)=pos.xnm(indg&~indpos)-drift.xy(2).x(pos.frame(indg&~indpos));
else
poso.xnm(indg)=pos.xnm(indg)-drift.xy(1).x(pos.frame(indg));
poso.xnm(indg)=pos.xnm(indg)-drift.xy(1).x(round(pos.frame(indg)));
end
end
if isfield(drift.xy(1),'y')
Expand All @@ -20,7 +20,7 @@
poso.ynm(indg&indpos)=pos.ynm(indg&indpos)-drift.xy(1).y(pos.frame(indg&indpos));
poso.ynm(indg&~indpos)=pos.ynm(indg&~indpos)-drift.xy(2).y(pos.frame(indg&~indpos));
else
poso.ynm(indg)=pos.ynm(indg)-drift.xy(1).y(pos.frame(indg));
poso.ynm(indg)=pos.ynm(indg)-drift.xy(1).y(round(pos.frame(indg)));
end
end
end
Expand Down
11 changes: 7 additions & 4 deletions plugins/+Process/+Register/RegisterImages.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@
% dxr=obj.getPar('shiftxy_min','layer',reflayer);
% dyr=obj.getPar('shiftxy_max','layer',reflayer);
if p.correctcoordinates

tch=obj.locData.loc.channel==p.targetchannels(1);
for k=2:length(p.targetchannels)
tch=tch|(obj.locData.loc.channel==p.targetchannels(k));
if isempty(p.targetchannels)
tch=true(size(obj.locData.loc.channel));
else
tch=obj.locData.loc.channel==p.targetchannels(1);
for k=2:length(p.targetchannels)
tch=tch|(obj.locData.loc.channel==p.targetchannels(k));
end
end
tfile=p.dataselect.Value==obj.locData.loc.filenumber;
tch=tch&tfile;
Expand Down
Loading

0 comments on commit 46c5152

Please sign in to comment.