This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from eidolon import * | |
# The Catmull-Rom basis types assume a fixed set of control points: 4 for 1D, 4**2 for 2D, and 4**3 for 3D. | |
# The piecewise Catmull-Rom allows a definition with an arbitrarily sized lattice of control points which is | |
# then divided up into individual elements which share control points of neighbours. The line example in the | |
# wiki shows an element composed of 3 lines. To allow the configuration of the element type, the basis function | |
# which returns coefficients for piecewise Catmull-Rom accepts extra parameters in addition to the xi coordinates | |
# (u,v,w): `ul', `vl', `wl' stating the dimensions of the control point lattice, `limits' stating for each dimension if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy this function into the Eidolon console then you can call it as described below. | |
def cropImage(img,minz,maxz,mint,maxt): | |
'''Crop image `img' in the Z (minz to maxz) and T dimensions (mint to maxt).''' | |
arr=img.plugin.getImageObjectArray(img) # break the image down into spatial components and numpy array | |
arr['array']=arr['array'][:,:,minz:maxz,mint:maxt] # crop the numpy array | |
arr['pos']=img.images[img.getVolumeStacks()[0][minz]].position # set the position to the bottom of the new stack | |
newimg=img.plugin.createObjectFromArray(img.getName()+'Crop',**arr) # create new image object | |
mgr.addSceneObject(newimg) # add image to scene | |
return newimg # return image |
NewerOlder