您好,欢迎来到爱问旅游网。
搜索
您的当前位置:首页3DZernike 3D 泽尼克矩

3DZernike 3D 泽尼克矩

来源:爱问旅游网
IntroductiontotheZernikeclasses

Mainlyjustalistofclassesandmethods

1Theclasses

•Moments-aclassforstoringandmanagingmoments•Voxels-aclassforstoringandmanagingavoxelisedgrid

•Zernike-aclassforcalculatingZernikemoments(fromavoxelobject)orreconstructinganobject(fromamomentsobject)YoucanimporttheseintothePythonenvironmentbytyping:

Therearethreeclasses:

fromZernikeimport*

andanobjectisinitialisedbytyping,forexample:

newmoments=Moments()voxels=Voxels()zcalc=Zernike()

MethodsarecalledintheusualCstyle:

newmoments.GetMomentSize()

2

2.1

TheMomentsClass

ResizeMoments(size)

Thisresizesthemomentsobjecttogotoordersize.Ifsizeisgreaterthanthecurrentorderthemomentsarepaddedwithzeros.Ifsizeislessthanthecurrentorderthemomentsbecometruncated.

1

newmoments.ResizeMoments(10)

2.2GetMomentSize()

Thisjustreturnsanintegershowingwhatorderthemomentsobjectgoesto.

printnewmoments.GetMomentSize()

2.3GetMoment(n,l,m)

Returnsacomplexnumbergivingthe(n,l,m)momentor’VOID’ifthatmomentdoesn’texist.

printnewmoments.GetMoment(5,3,-1)

2.4SetMoment(n,l,m,value)

Setsthe(n,l,m)momenttobeequaltovalue.

newmoments.SetMoment(5,3,-1,5+2j)

2.5DisplayAllMoments()

Displaysallthenon-zeromomentsinarelativelytidyfashion.

newmoments.DisplayAllMoments()

2.6SaveMoments(filename)

Savethecurrentmomentsto’filename’.

2

newmoments.SaveMoments(\"test.mom\")

2.7LoadMoments(filename)

Loadasetofmoments(thatwassavedusingSaveMoments())intoamomentsobject.

newmoments.LoadMoments(\"test.mom\")

3TheVoxelsclass

ThisstoresandmanipulatedallofthevoxeldataincludingreadinginaPDBfile(caneasilyaddotherformats).

3.1SetResolution(resolution)

Thissetsthegridtobearesolution*resolution*resolutiongrid.Ifthecurrentresolutionisgreaterthenanyolddatagetstruncated(ratherthanresized).Sameiftheresolutionisbeingincreased.Theolddataiskeptatthe’topleft’ofthegridandblankvoxelsareaddedaroundit.

vox.SetResolution()

3.2GetResolution()

Thisreturnsthecurrentgridresolution.

printvox.GetResolution()

3.3SetVoxel(x,y,z,value)

Thissetsthevoxelatposition(x,y,x)to’value’.x,yandzareintegersbetween0andtheresolution-1.

3

vox.SetVoxel(13,14,16,0.314)

3.4GetVoxel(x,y,z)

Thisreturnsthevalueofthevoxelatpositionx,y,z.

printvox.GetVoxel(13,14,16)

3.5DisplayAllVoxels()

Thisdisplaysthevalueofallnon-zerovoxelsinthegridintheformat’xyzvalue’.

vox.DisplayAllVoxels()

3.6Mirror()

Thiscreatesamirrorimage(aboutthey-zplane)ofthevoxelsandreturnsinaseparateobject.

mvox=vox.Mirror()

3.7Grid2DX(filename)

Thiswritesoutthevoxeldatainthe.DXformat,viewablewithinPyMol.

vox.Grid2DX(\"text.dx\")

3.8DisplayInfo()

Thisdisplaysallofthemetadataextractedfromtheloadedstructure.AtthemomentjustthetitleandauthorsfromthePDBfilebutit’sexpandable.

4

vox.DisplayInfo()

3.9LoadStructure(filename)

Thiswilllookatthefilenamesuffixanddependingonwhetheritknowsthesuffixornotwilleitherreadinthestructuredataandvoxeliseitorreturnanerrormessage.Atthemomenttheonlystructureformatitunderstandis.pdb,butit’seasilyexpandable.ThisfunctionwillcallthegenericfunctionLoadLines(filename)toreadinthedataandthenthePDBspecificfunctionConvertPDBtoconvertthereaddataintovoxels.Theresolutionoftheconver-sionshouldbesetbeforethisfunctioniscalledwiththeSetResolutionfunction.

vox.LoadStructure(\"1fxz.pdb\")

3.10SaveVoxels(filename)

Thiswillsavethevoxeldata,andstructurefileusedtogeneratethedataandthemetadatastoredintheconversion.

vox.SaveVoxels(\"voxels.vox\")

3.11LoadVoxels(filename)

ThiswillloadallthedatastoredbytheSaveVoxelsfunction.

vox.LoadVoxels(\"voxels.vox\")

4TheZernikeobject

Thisisresponsibleforcalculatingmomentsfromvoxelsandreconstructingvox-elsfrommoments.Itcontainsthemostfunctionsofalltheclassesbutmostareforinternaluse.Thereareonlyafewfunctionsthattheuseractuallyneeds.Alotofdataisstoredinadictionarythefirsttimeit’sused,sosubsequentcalculationsshouldspeedupconsiderably.

5

4.1CalculateMoments(voxels,order)

Thisfunctiontakesavoxelsobjectandwillreturnthemomentsuptothespecifiedorder.Allthegridresolutiondataisextractedfromthevoxelsobject.

moments=zern.CalculateMoments(vox,15)

4.2InitialiseReconstruction(moments,order,resolution)

Thiswilldothesetupworkbeforedoingareconstructionofthespecifiedreso-lution(whichdoesn’thavetobethesameastheoriginalvoxelisation)computedfromthemomentspassed.

zern.InitialiseReconstruction(moms,20,)

4.3ReconstructVoxel(x,y,z)

Thiswillreturnthereconstructedvalueofthevoxelatpositionx,y,z.Thisisrequiredbythefunctionsthedoacompletereconstruction,butit’sunlikelythattheuserwillneedtousethis.

print.ReconstructVoxel(13,14,16)

4.4ReconstructAll()

Thiswillreturnavoxelobjectcalculatedfromreconstructingeveryvoxelintheunitball.TheimplementationiscompletelyinPythonsothefirsttimeitrunsitwillbeslow.Howeverthesecondtimeitrunsshouldbemuchfasterduetothecachingofcomputedvalues(whichcanbesaved).

vox=zern.ReconstructAll()

6

4.5ReconstructGrow()

Thiswillcreateareconstructionusingaregiongrowingalgorithm.Itwillstartfromthecentralvoxelandexpandthatregionuntiltheedgeoftheobject(inthiscaseasdefinedinthefunctionInRegion(xyz))isfound.Thisshouldresultinaspeedincreaseasnon-emptyvoxelswillnotbevisited.Obviouslytheobjectneedstobecontinuousforbitsnottobemissed.

Theoverheadoftheregiongrowingalgorithmisinsignificant.Thismeansthat,forallintentsandpurposes,theperformanceyougainbyusingtheregiongrowingalgorithmisdirectlyproportionaltothepercentageoffilledvoxels.It’squitenormaltohave¿80%vacancyintheproteinstuff.Soyou’relookingat,typicallyan80-90%speedincreasebyusingthisalgorithm.

vox=zern.ReconstructGrow()

7

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- awee.cn 版权所有 湘ICP备2023022495号-5

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务