
Install
Setup
Use
conversion of stacks
command line
making scripts
some little tools when running interactively
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course
r=nx/2 # this will mask only the corners of the image
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask # can do math on images!
back_1d = Util.compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
| Added: | ||||||||
| > > | Notes stolen from sparx site for convenience
READ IMAGE
. a = EMData()
. a.read_image("name.hdf")
. a.read_image("bdb:name")
. or
. a = [[get_image]]("name.hdf")
. a = [[get_image]]("bdb:name")
. a = EMData()
. i=12
. a.read_image("name.hdf" , i)
. a.read_image("bdb:name", i)
. a = EMData.read_images("name.hdf")
. a = EMData.read_images("bdb:name")
. stack = "data.hdf" . stack = "bdb:data" . n = EMUtil.get_image_count(stack)
. ima = EMData() . ima.read_image(stack, 0, True) | |||||||
| ||||||||
| Added: | ||||||||
| > > | ||||||||
Install
| ||||||||
| Added: | ||||||||
| > > | Setup
| |||||||
Use
conversion of stacks
command line
making scripts
some little tools when running interactively
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course
r=nx/2 # this will mask only the corners of the image
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask # can do math on images!
back_1d = Util.compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
Install
Use
conversion of stacks
command line
making scripts
some little tools when running interactively
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course
r=nx/2 # this will mask only the corners of the image
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask # can do math on images!
back_1d = Util.compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
| Changed: | ||||||||
| < < | ||||||||
| > > |
| |||||||
| Added: | ||||||||
| > > | all_alltrib=data.get_attr_dict() | |||||||
| ||||||||
Install
Use
conversion of stacks
command line
making scripts
some little tools when running interactively | ||||||||
| Changed: | ||||||||
| < < |
| |||||||
| > > |
| |||||||
| data=EMData() #create an object to hold the image data.read_image("recon_1-20.hdf",0) #reads the first image from the stack recon_1-20.hdf display(data) # view the image using e2display data.get_attr("minimum") # print min value of image data.get_attr("maximum") # max data.get_attr("mean") #mean value of image data.get_attr("sigma") # std dev data.get_attr("nx") # x-size of image -- use ny nz for other dims | ||||||||
| Changed: | ||||||||
| < < | data.write_image("out.hdf",0) # write image data to file, hdf5 format | |||||||
| > > | data2 = data * 5 #make new image with 5X intensities of original | |||||||
| Added: | ||||||||
| > > | data2.write_image("out.hdf",0) # write image data to file, hdf5 format | |||||||
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course
r=nx/2 # this will mask only the corners of the image
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask # can do math on images!
back_1d = Util.compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
Install
Use
conversion of stacks
command line
making scripts
some little tools when running interactively
| ||||||||
| Added: | ||||||||
| > > | data.write_image("out.hdf",0) # write image data to file, hdf5 format | |||||||
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course | ||||||||
| Changed: | ||||||||
| < < | r=nx # this will mask only the corners of the image | |||||||
| > > | r=nx/2 # this will mask only the corners of the image | |||||||
| mask=model_circle(r,nx,ny) square=model_blank(nx,ny,bckg=1) inv_mask = square-mask # can do math on images! | ||||||||
| Changed: | ||||||||
| < < | back_1d = compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data | |||||||
| > > | back_1d = Util.compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data | |||||||
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
Install
Use
conversion of stacks
command line
| ||||||||
| Added: | ||||||||
| > > | making scripts | |||||||
some little tools when running interactively
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course
r=nx # this will mask only the corners of the image
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask # can do math on images!
back_1d = compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
Install
| ||||||||
| Changed: | ||||||||
| < < |
| |||||||
| > > |
| |||||||
Use
conversion of stacks
command line
some little tools when running interactively
data=EMData() #create an object to hold the image
data.read_image("raw.hdf",0) #reads the first image from the stack
nx = data.get_attr("nx")
ny=nx # image should be square of course
r=nx # this will mask only the corners of the image
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask # can do math on images!
back_1d = compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd # can also do scalar math on images!
norm.write_image("normalised.hdf",0)
| ||||||||
| Added: | ||||||||
| > > |
| |||||||
| ||||||||
Install
Use
conversion of stacks
command line
some little tools when running interactively
data=EMData() #create an object to hold the image | ||||||||
| Changed: | ||||||||
| < < | data.read_image("recon_1-20.hdf",0) #reads the first image from the stack recon_1-20.hdf | |||||||
| > > | data.read_image("raw.hdf",0) #reads the first image from the stack | |||||||
| Added: | ||||||||
| > > | nx = data.get_attr("nx") ny=nx # image should be square of course r=nx # this will mask only the corners of the image | |||||||
| mask=model_circle(r,nx,ny) square=model_blank(nx,ny,bckg=1) | ||||||||
| Changed: | ||||||||
| < < | inv_mask = square-mask | |||||||
| > > | inv_mask = square-mask # can do math on images! | |||||||
| back_1d = compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data mean = back_1d.get_attr("mean") sd = back_1d.get_attr("sigma") | ||||||||
| Changed: | ||||||||
| < < | norm = (data - mean) / sd | |||||||
| > > | norm = (data - mean) / sd # can also do scalar math on images! | |||||||
norm.write_image("normalised.hdf",0)
| ||||||||
Install
Use
conversion of stacks
command line
some little tools when running interactively
data=EMData() #create an object to hold the image
data.read_image("recon_1-20.hdf",0) #reads the first image from the stack recon_1-20.hdf
mask=model_circle(r,nx,ny)
square=model_blank(nx,ny,bckg=1)
inv_mask = square-mask
back_1d = compress_image_mask(data,inv_mask) # converts all image data under the mask to a 1D image -- for getting the stats of the corner data
mean = back_1d.get_attr("mean")
sd = back_1d.get_attr("sigma")
norm = (data - mean) / sd
norm.write_image("normalised.hdf",0)
|