How do I extract a spectrum from a 3D spectrum-image

本小妞迷上赌 提交于 2019-12-24 02:23:49

问题


In DigitalMicrograph I have a 3D data cube of size [X x Y x Z] and I would like to extract a single spectrum at position X/Y. I know I can address the sub-volume by two opposing corners (x1/y1/z1) and (x2/y2/z2). But when I do this in the script below, I only get a LinePlot display with a single value. What am I doing wrong ?

number px = 5
number py = 3

image SIblock := GetFrontImage()
number sx, sy, sz
Get3DSize( SIblock, sx, sy, sz )
image spec = SIblock[ px, py, 0, px+1, py+1, sz ]

ShowImage( spec )

回答1:


You solution addresses the right section of the volume but as a [1 x 1 x sz] image. You could rotate the image, but a better solution is to use the slice1() command which directly access a 1-dimensional subvolume as in the following modified script:

number px = 5
number py = 3
image SIblock := GetFrontImage()
number sx, sy, sz
Get3DSize( SIblock, sx, sy, sz )
image spec := Slice1( SIblock, px,py,0,  2,sz,1 )
image specCopy := ImageClone( spec )
ShowImage( specCopy )

The command has 7 parameters: the source image (any dimension), the starting coordinate of the volume as x/y/z and a triplet describing the sampling: The direction ( 0=x 1=y 2=z ), the number of steps in that direction and a stepsize.

Note that my script also used image spec := and not image spec =. The difference is, that = copies the values (and creates a new image) while := assigns the right-handside. spec is just another name for the identical memory space of SIblock. Changing the values of spec would change the according subvolume of SIblock. My script therefore creates another image specCopy with the command ImageClone() to really creat a separate 'extracted' image.



来源:https://stackoverflow.com/questions/26275689/how-do-i-extract-a-spectrum-from-a-3d-spectrum-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!