DDSM图像以.LJPEG格式压缩,在处理之前需要先解压缩。
我已经想出了一种将DDSM图像转换为原始图像的方法,但是这是一条漫长的路,我也没有更好的方法。
-
读取DDSM数据集图像的步骤:
- 将存储库克隆到https://github.com/multinormal/ddsm https://github.com/multinormal/ddsm,其中包含两个可执行文件[
jpeg.exe
and ddsmraw2pnm.exe
].
2-下载并安装cygwin http://cygwin.com/setup.exe.
3-下载和设置Matlab pnmreader代码 http://www.mathworks.com/matlabcentral/fileexchange/4176-pnm-toolbox-3-01?download=true.
4- 创建一个文件夹并使其内容如下:
- jpeg.exe
- ddsmraw2pnm.exe
- 转换DDSMImageToRaw.m [实施稍后再回答 ]
- cygwin1.dll [从“C:\cygwin”或安装了 cygwin 的其他位置 ]
5- the ConvertDDSMImageToRaw
功能实现。
function ConvertDDSMImageToRaw(filename, columns, rows, digitizer)
%// ConvertDDSMImageToRaw Convert an image of ddsm database to raw image.
%// -------------------------------------------------------------------------
%// Input:-
%// o filename : String representing ddsm image file name.
%// o columns : Double representing number of columns in the image.
%// o rows : Double representing number of rows in the image.
%// o digitizer: String representing image normalization function name,
%// which differ from one case to another and have the set of
%// values ['dba', 'howtek-mgh', 'howtek-ismd' and 'lumisys' ]
%// -------------------------------------------------------------------------
%// Prepare and execute command of image decompression
commandDecompression = [which('jpeg.exe') ' -d -s ' filename];
dos(commandDecompression);
%// -------------------------------------------------------------------------
%// Prepare and execute command that convert the decompressed image to pnm format.
rawFileName = [ filename '.1'];
columns = num2str(columns);
rows = num2str(rows);
digitizer = ['"' digitizer '"'];
commandConversion =[ which('pnm.exe') ,' ',rawFileName,' ',columns,' ',rows,' ',digitizer];
dos(commandConversion);
%// -------------------------------------------------------------------------
%// Wrtie the image into raw format
pnmFileName = [rawFileName '-ddsmraw2pnm.pnm'];
image = pnmread(pnmFileName);
imwrite(image,[filename '.raw']);
end
6-获取图像信息[cols,rows,digitizer]
来自 .ics 文件:
如果数字化仪是“howtek”,请将其用作“howtek-mgh”,这就是我的想法。
7- 现在使用我们实现的函数转换图像,如下所示:
filename = 'A_1709_1.LEFT_CC.LJPEG';
digitizer = 'howtek-mgh';
imageSize = [ 5341 2806 ];
ConvertDDSMImageToRaw(filename, imageSize(1) , imageSize(2), digitizer);