Skip to content
Snippets Groups Projects
Commit 9847da0f authored by ac_fx's avatar ac_fx
Browse files

Merge branch 'log_seg' of git-bioimage.coe.drexel.edu:bioimage/leverjs into log_seg

parents d657bc44 582eed5c
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@ const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
const {ipcMain} = require('electron');
......@@ -24,7 +23,9 @@ function createWindow ()
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600, icon:path.join(__dirname,'..','leverjs/leverjs.ico'),
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
}
});
......
......@@ -41,7 +41,8 @@ var miniMapmousedrag = false;
// database is read only
var gbReadOnlyDB=false;
const IS_NODE = typeof module !== 'undefined' && module.exports;
// const IS_NODE = typeof module !== 'undefined' && module.exports;
var IS_NODE = navigator.userAgent.indexOf('Electron') >= 0
// set to tell render.js (reDraw) not to kick off a multires if we're in the experiment window
var gbExperimentRender=false;
......@@ -171,7 +172,7 @@ window.onload = function () {
ROOT=params[1].slice('ROOT='.length)
title=params[2].slice('TITLE='.length)
console.log('lever figure window found :: port='+port+" :: root="+root)
console.log('lever figure window found :: port='+port+" :: root="+ROOT)
uiServer.init(port,window)
document.title='leversc '+title
setLeverscUI()
......
......@@ -106,8 +106,18 @@ end
function launch_electron_posix(port,fignum,workdir, leverpath,strDB)
elec_cmd = 'leverjs';
px = getenv('PATH');
if ( ~isempty(leverpath) )
% first try NVM
nvm_path = getenv('NVM_DIR');
if ~isempty(nvm_path)
[ret,elec_path] = system('source ~/.nvm/nvm.sh;which electron');
elec_path = replace(elec_path,newline,'');
nodePath = fileparts(elec_path);
px = [px ':' nodePath];
else
elec_path = fullfile(leverpath,'node_modules','.bin','electron');
end
elec_cmd = [elec_path ' ' fullfile(leverpath,'elever','main.js')];
else
[status,~] = system(['which ' elec_cmd]);
......@@ -118,8 +128,8 @@ end
if exist('strDB','var') && ~isempty(strDB)
elec_cmd = [elec_cmd ' --leverFile=' strDB ' '];
end
cmd = [elec_cmd ' --port=' num2str(port) ' --title="figure ' num2str(fignum) '"' ' &'];
system(cmd);
cmd = [elec_cmd ' --port=' num2str(port) ' --title="figure ' num2str(fignum) '"' ' &']
system(cmd,'PATH',px);
end
function launch_electron_windows(port,fignum,workdir, leverpath, strDB)
......
function [nPixels,microns] = scaleBar(CONSTANTS,targetPixels)
function [nPixels,microns] = scaleBar(CONSTANTS,targetPixels,szim)
if ~exist('targetPixels','var')
targetPixels = 100;
......@@ -9,7 +9,10 @@ microns = targetPixels .* microns_per_pixel;
microns = 5 * round(microns/5);
nPixels = round(microns / microns_per_pixel);
rectangle('Position',[2*size(im,2)-100,25,nPixels,10],'facecolor','w')
text(2*size(im,2)-100+nPixels/2,25,'30um','color','w','HorizontalAlignment','center', ...
'VerticalAlignment','bottom')
% rectangle('Position',[szim(2)-100,25,nPixels,10],'facecolor','w')
% text(szim(2)-100+nPixels/2,25,'30um','color','w','HorizontalAlignment','center', ...
% 'VerticalAlignment','bottom')
rectangle('Position',[szim(2)-30-nPixels,40,nPixels,15],'FaceColor','w');
% text(szim(2)-30-nPixels,15,[num2str(microns) '\mum'],'color','w','VerticalAlignment','top','fontsize',12)
text(szim(2)-30-nPixels,5,[num2str(microns) '\mum'],'color','w','VerticalAlignment','top','fontsize',12)
% this code can be functionalized
% can also add features:
% periodicity toggle? if true remove final frame
% changing number of inbetweens to speed up or slow down the animation
fileName = 'ssfClustering'; % name of movie generated
frameRate = 30; % desired frame rate
duration = 30; % desired length of movie in seconds
azimuthList = [-20,-110,-190,-290,-380]; % camera pan angle at key frames
elevationList = [10,10,10,10,10]; % camera tilt angle at key frames
v = VideoWriter(fileName,'MPEG-4');
v.FrameRate = frameRate;
open(v);
% interpolate viewing angles between key frames to match the specified duration
keyFrameList = [azimuthList;elevationList]';
numFrames = round(duration * frameRate);
intervalLength = (numFrames - 1) / (size(keyFrameList,1) - 1);
% initialize the angleList
angleList = zeros(numFrames,2);
for numKeyFrame = 1:size(keyFrameList,1) - 1
firstRow = round(intervalLength * (numKeyFrame - 1) + 1); % first row of the interval between key frames
lastRow = round(intervalLength * numKeyFrame + 1); % last row of the interval between key frames
a = keyFrameList(numKeyFrame,1); % initial key frame azimuth angle
b = keyFrameList(numKeyFrame + 1,1); % ending key frame azimuth angle
c = keyFrameList(numKeyFrame,2); % initial key frame elevation angle
d = keyFrameList(numKeyFrame + 1,2); % ending key frame elevation angle
n = round(intervalLength * numKeyFrame) - round(intervalLength * (numKeyFrame - 1)) + 1; % number of angles to add
angleList(firstRow:lastRow,:) = [linspace(a,b,n).' , linspace(c,d,n).'];
end
% capture frames and write to the movie file
for frame = 1:size(angleList,1)
view(angleList(frame,:));
drawnow;
writeVideo(v,getframe(gcf));
end
close(v);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment