-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSEM_Hitachi_Scale.ijm
45 lines (40 loc) · 1.42 KB
/
SEM_Hitachi_Scale.ijm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2018-2023 Zhou XU
//
// This file is part of ImageJ plugin EM-tool.
//
// EM-tool is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// EM-tool is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with EM-tool. If not, see <http://www.gnu.org/licenses/>.
//
//
// Set Hitachi SEM scale from acquisition metadata .txt file
// Author: Zhou XU
// at Monash Centre for Electron Microscopy
// Windows 10 Enterprise Ver. 1803
// ImageJ ver. 1.52g
path = getDirectory("image");
if (path=="") exit ("path not available");
name = getInfo("image.filename");
if (name=="") exit ("name not available");
id = path + name;
txtID = replace(id, ".tif", ".txt");
txtID = replace(txtID, ".jpg", ".txt");
lineseparator = ",\n\t";
cellseparator = "=";
lines=split(File.openAsString(txtID), lineseparator);
for (i=0; i<lengthOf(lines); i++)
{
items=split(lines[i], cellseparator);
for (j=1; j<lengthOf(items); j++)
if (items[0]=="PixelSize") pixelSize = items[1];
}
setVoxelSize(pixelSize, pixelSize, 1, "nm");