美文网首页
ImageJ生成Calibration bar指标尺图片

ImageJ生成Calibration bar指标尺图片

作者: w快乐的西西弗 | 来源:发表于2021-12-16 16:28 被阅读0次

1. 关键:用矩形框住calibration bar后,右键duplicate

1. 主要步骤

I、先在recon image中生成一个合适大小的矩形roi(最好用macro生成)

一般使改roi垂直居中

I、Analyze->Tools->Calibration bar

在弹出的对话框的location选择At selection,不要勾选overlay(否则会破坏原图像),设置合适的Number of labels(一般为3)和decimal(如果有小数,则设为0)。

II、这时会生成一幅RGB格式的包含Calibration bar的新图片

如果只需要灰度图像,则这时将图像格式改为灰度。

III、生成一幅与原图像等高的独立calibration bar图片

用macro(setpixel函数)把calibration bar矩形的上下的像素全改为白色,然后选一个与原图像等高的包含calibration bar的矩形roi,右键duplicate。

方法2:只框住calibration bar,右键duplicate。然后在PS中新建一个与原图像等高,calibration bar等宽的新图像,将calibration bar居中嵌入。注意,RGB格式的图像应设为8位,否则无法保存为eps格式。

2. Macro:recon指标尺,cali_bar_macro.txt

pixSize=256;whitePixelVal=255;

xStart=200;width=57;height=148;

yStart=(pixSize-height)/2;

xEnd=xStart+width;yEnd=(pixSize+height)/2;

makeRectangle(xStart, yStart, width, height);

run("Calibration Bar...", "location=[At Selection] fill=White label=Black //number=3 decimal=0 font=12 zoom=1");

run("32-bit");//change RGB to gray image

run("In [+]");

for(yInd=0;yInd<pixSize;yInd++)

{

for(xInd=xStart;xInd<pixSize;xInd++)

{

if(yInd<=yStart || yInd >=yEnd)

setPixel(xInd, yInd, whitePixelVal);

}

}

makeRectangle(xStart, 0, width-3, pixSize);

run("Duplicate...", " ");

3. Macro:bias指标尺bias_cali_bar_macro.txt

//Cali bar locates at the center

//size of cali image  is 256 /times 256

pixSize=256;whitePixelVal=255;

width=57;height=148;

xStart=(pixSize-width)/2;yStart=(pixSize-height)/2;

xEnd=xStart+width;yEnd=(pixSize+height)/2;

makeRectangle(xStart, yStart, width-3, height);

run("Calibration Bar...", "location=[At Selection] fill=White label=Black //number=5 decimal=1 font=12 zoom=1");

run("32-bit");//change RGB to gray image

run("In [+]");

for(yInd=0;yInd<pixSize;yInd++)

{

for(xInd=xStart;xInd<xEnd;xInd++)

{

if(yInd<=yStart || yInd >=yEnd)

setPixel(xInd, yInd, whitePixelVal);

}

for(xInd=0;xInd<xStart;xInd++)

{

setPixel(xInd, yInd, whitePixelVal);

}

for(xInd=xEnd;xInd<pixSize;xInd++)

{

setPixel(xInd, yInd, whitePixelVal);

}

}

相关文章

网友评论

      本文标题:ImageJ生成Calibration bar指标尺图片

      本文链接:https://www.haomeiwen.com/subject/bryvfrtx.html