DDSM 图像以 .LJPEG 格式压缩,在处理它们之前需要先解压缩。
我已经想出了一种将 DDSM 图像转换为原始图像的方法,但它还有很长的路要走,而且我没有更好的方法。
2-下载并安装cygwin。
3- 下载并设置 Matlab pnmreader 代码。
4-创建一个文件夹并使其内容如下:
- JPEG文件
- ddsmraw2pnm.exe
- ConvertDDSMImageToRaw.m [实现稍后在回答]
- cygwin1.dll [来自 "C:\cygwin" 或您安装 cygwin 的其他地方]
5-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);