透射电镜两大图像格式,dm3和ser,分属Gatan和ThermoFisher(原FEI)。Gatan放出了公开版的GMS,可以免费使用和转换dm3格式为tif,但是ThermoFisher就很抠,离了电镜没有公开的TIA软件可用于处理和转换图像,已知的一些破解版本都很老旧。
现在试出一种方法,用ImageJ软件配合插件去批量将ser文件转换成jpg文件,就可以进行后续处理了。
ImageJ软件版本很重要,版本不对,插件里使用的函数识别不出来,已知Fiji版本(Fiji: ImageJ, with "Batteries Included")可以满足需求,注意下载后Fiji文件夹放置路径不能有中文名。
使用方法:
1.下载Fiji
2.下载TIA_reader.jar 插件放入plugins文件夹
3.下载TEM_Ser_dm3_Folder_Export.ijm插件放入plugins文件夹
4.在ImageJ的plugins下面找到TEM_Ser_dm3_Folder_Export即可使用。
感谢“我不是龙哥”文章的帮助,以下为“我不是龙哥”原文原版转载
透射TIA(.ser)和DM(.dm3)文件批量转换为图片 - 哔哩哔哩
我们拿到的透射电镜原始数据格式,主要是TIA拍摄的.ser(.emi为TIA内部格式,第三方软件不可读)以及DM拍摄的dm3格式。对于dm3格式转成普通图片比较容易,因为新版DM已经免费,网上也还有各种旧版可以搜到。然而.ser格式对于部分同学可能还是比较麻烦,虽然也有TIA安装包和教程(鄙人也上传过,需要的可以自行查看),但是还是有部分人会装不上。
那么还有没有其他软件可以实现将.ser直接转换成图片呢?当然是有的,那就是Image J。其实这也是一个功能强大的软件,可以添加各种插件,功能很多,我们利用它可以将.ser文件批量转为图片。下面介绍怎么使用Image J进行.ser文件读取和批量转换。
软件下载地址:https://imagej.nih.gov/ij/download.html
https://imagej.net/ij/download.html
Image J软件下载页面,选择对应系统版本下载即可。
插件下载地址:https://imagej.nih.gov/ij/plugins/index.html#io
https://imagej.net/ij/plugins/index.html#io
插件下载页面
对于我们处理dm3和ser文件,只需要下载TIA Reader就行了,其他插件可以自行探索。将下载的软件压缩包解压,把下载的TIA Reader插件复制到文件夹:ImageJ\plugins\Input-Output。此时直接运行Image J文件夹下的Image J.exe就可以打开软件:
Image J 软件主界面
可以看到Plugins->Input-Output下有了TIA Reader插件:
Input-Output下TIA Reader插件
利用TIA Reader便可以直接打开ser格式TEM图片:
Image J打开ser格式图片窗口,虽然没有标尺,但是窗口顶部有整张图片的尺寸信息,利用这个信息便可以添加标尺。
可以看到Image J还自带了dm3插件,因此也可以直接读取dm3格式TEM图片。下一步我们讲如何实现批量转换。批量转换需要添加另一个插件,该插件可以将文件夹下的ser和dm3文件同时转换为普通图片,名称为TEM_Ser_dm3_batch_convert.ijm,插件由github上IMBalENce发布,原地址:https://github.com/IMBalENce/EM-tool。部分愿意折腾的同学可以在文末获取该插件源码,将源码复制到文本文档中便可进行修改调试,然后将名称及后缀修改为TEM_Ser_dm3_Folder_Export.ijm,同样复制到文件夹ImageJ\plugins\Input-Output。不愿麻烦的直接下载(链接:https://pan.baidu.com/s/1gcCW2sW4_01knRis7Hvc3Q
提取码:2ueq 复制这段内容后打开百度网盘手机App,操作更方便哦),然后复制到对应文件夹,重启软件就可以看到该插件:
TEM_Ser_dm3_Folder_Export
好了,这回愉快地进行批量格式转换吧!点击插件后选择源文件夹和导出目标文件夹:
选择源文件夹和导出目标文件夹,可以复制目录填入
软件会自动完成转换,转换出的图片标尺信息在文件名末尾,为整图横向尺寸信息。如下图所示:
导出图片尺寸信息在文件名末尾,为整图尺寸
(说明:试用过程发现转换为tif格式会出现图片衬度不对,即整图全黑。因此,此处给出的插件已经自行修改为导出jpg格式,如果需要其他格式请自行研究。
注意:如果数据中有EDS面扫和线扫,请将对应的文件先拿出再进行转换,否则插件会读取每个点的谱图造成速度缓慢,不过没有其他问题。)
TEM_Ser_dm3_batch_convert插件源码:
// Batch convert TIA or Gatan dm3 image file to tiff
// by Zhou XU
// 2020/05/05
// at Monash Centre for Electron Microscopy
// Windows 10 Enterprise Ver. 1803
// ImageJ ver. 1.52p
List.setCommands;
if (List.get("TIA Reader")!="") {
// Check to make sure TIA reader plugin is installed
//open directory of images
input = getDirectory("location where images are stored");
output = getDirectory("Location for results");
// determine number of Files of given FileFormat
list = getFileList(input);
ImgNumber=0;
for (i=0; i<list.length; i=i+1) {
if (endsWith(list[i], ".ser")) {
ImgNumber=ImgNumber+1;
filename = input + list[i];
print(filename);
run("TIA Reader", ".ser-reader...=filename");
// get the pixel size and unit of image, TIA reader should have set the scale when import in
getPixelSize (unit, pixelWidth, pixelHeight);
imageWidth = getWidth();
HFW = imageWidth * pixelWidth;
filename_short = substring(list[i], 0, lastIndexOf(list[i], "."));
exportFile = output + filename_short +"_HFW"+ HFW + unit + ".jpg";
saveAs("JPEG", exportFile);
run("Close All");
}
else if (endsWith(list[i], ".dm3")) {
// for gatan dm3 files
ImgNumber=ImgNumber+1;
filename = input + list[i];
print(filename);
open(filename);
// get the pixel size and unit of image, TIA reader should have set the scale when import in
getPixelSize (unit, pixelWidth, pixelHeight);
imageWidth = getWidth();
HFW = imageWidth * pixelWidth;
filename_short = substring(list[i], 0, lastIndexOf(list[i], "."));
exportFile = output + filename_short +"_HFW"+ HFW + unit + ".jpg";
saveAs("JPEG", exportFile);
run("Close All");
}
}
}
else {
Dialog.create("Error");
Dialog.addMessage("TIA Reader plugin is not intalled, \nplease download and install from \nhttps://imagej.nih.gov/ij/plugins/tia-reader.html \n ");
//Dialog.addHelp("<html>https://imagej.nih.gov/ij/plugins/tia-reader.html");
Dialog.show();
} 作者:我不是龙哥 https://www.bilibili.com/read/cv10923101 出处:bilibili