├── .gitignore ├── CTrecon.m ├── CTsimulation.m ├── IO ├── cfgmatchrule.m ├── checkrawfile.m ├── cleanpath.m ├── clearbincfg.m ├── decodenumber.m ├── dicommeta.m ├── external │ └── extrernal ├── general │ ├── jsonformat.m │ ├── jsonread.m │ ├── jsonwrite.m │ ├── myxml2struct.m │ └── struct2xml.m ├── loadbindata.m ├── loaddata.m ├── loaddicomimg.m ├── packstruct.m ├── readcfgfile.m ├── sparsepack.m ├── standard │ ├── air_corr_v1.0.xml │ ├── air_corr_v1.10.xml │ ├── beamharden_corr_v1.0.xml │ ├── beamharden_corr_v1.11.xml │ ├── beamharden_corr_v1.12.xml │ ├── beamharden_corr_v2.0.xml │ ├── boneharden_corr_v1.0.xml │ ├── boneharden_corr_v1.12.xml │ ├── bowtie_corr_v1.0.xml │ ├── corrbase.xml │ ├── crosstalk_corr_v1.0.xml │ ├── crosstalk_corr_v1.11.xml │ ├── detector_corr_v1.0.xml │ ├── detector_corr_v1.11.xml │ ├── detectorextra_corr_v1.0.xml │ ├── hounsefield_corr_v1.0.xml │ ├── idealwater_corr_v1.0.xml │ ├── iteration_corr_v1.0.xml │ ├── iteration_corr_v1.1.xml │ ├── materialdecomp_corr_v1.0.xml │ ├── nonlinear_corr_v1.0.xml │ ├── nonlinear_corr_v1.11.xml │ ├── offfocal_corr_v1.0.xml │ ├── offfocal_corr_v2.0.xml │ ├── rawdata_v1.0.xml │ ├── rawdatabase.xml │ └── tube_corr_v1.0.xml ├── struct2binfile.m ├── structbincfg.m └── subconfigure.m ├── LICENSE ├── README.md ├── cali ├── aircalibration.m ├── calicorrprepare.m ├── calidataprepare.m ├── caliprmforcorr.m ├── calixml │ ├── Aircali_sample.xml │ ├── BHcali_sample.xml │ ├── Zcali_sample.xml │ ├── corrcouple_sample.xml │ ├── protocol_beamharden.xml │ └── protocol_nonlinear.xml ├── collimatedcorr.m ├── corrcouplerule.m ├── experiment │ ├── bfbacktobh_test1.m │ ├── bladeexperiment.m │ ├── bladeexperiment2.m │ ├── bowtieexperiment.m │ ├── expbfback_test1.m │ ├── loadraw_scp1.m │ ├── loadraw_scp2.m │ ├── spectfit_test1.m │ ├── spectfitfun.m │ └── testdata │ │ └── response_1219.mat ├── focalspot20x.m ├── lib │ ├── invpolyval.m │ ├── iterinvpolyval.m │ ├── iterpolyval.m │ ├── pinleftoptmatrix.m │ ├── pinprojectfun.m │ ├── pinsplines.m │ ├── polyval2dm.m │ ├── polyval3dm.m │ ├── ppcenterderivative.m │ ├── ppweightcenter.m │ ├── translatefillup.m │ └── translatefillup_back.m ├── offfocalloadkernel.m ├── parameterforcorr.m ├── pindetcalibration.m ├── simuAircali.m ├── simuBHcali.m ├── simuBHcali2.m ├── simuBonehardencali.m └── simuBonehardencali2.m ├── doc ├── UserGuide.html ├── fig │ └── addtool1.png └── html │ ├── configurethereconpipeline.html │ ├── configurethesimulation.html │ ├── protocolandnamerule.html │ ├── quickstart.html │ └── systemandsystemdatafiles.html ├── geometry ├── fillupobject.m ├── homotopy │ ├── S3renormalize.m │ ├── cylinderconecut.m │ ├── samplesetinobject.m │ └── square2circle.m ├── intersection.m ├── intersection │ ├── linesinimage2D.m │ ├── linesinimage2Dmosaic.m │ ├── linesinimage3D.m │ ├── linesinimage3Dmosaic.m │ ├── linesinimageLI2D.m │ ├── linesinimageLI2D2.m │ ├── linesinobject.m │ ├── multiinsect.m │ ├── parallelcrossprojectimg2D.m │ ├── parallellinearinterp2D.m │ ├── parallellinearinterp2D2.m │ ├── parallellinearinterp3D.m │ ├── parallellinearinterp3D2.m │ ├── parallellinearinterp3D3.m │ ├── parallelprojinimage.m │ └── projectioninimage.m ├── lib │ ├── ASGmodel.m │ ├── defaultvolume.m │ ├── objectrotation.m │ ├── pararea.m │ ├── pararea2.m │ ├── polar2xyz.m │ ├── square2circle.m │ └── xyz2polar.m ├── objectvisual.m ├── ppcenterderivative.m ├── ppweightcenter.m ├── prepareasgdata.m ├── samplesetinobject.m └── visual │ ├── objectmeshgrid.m │ └── tetrahedmesh.m ├── physics ├── airprojection.m ├── detectorslicemerge.m ├── effectZandMass.m ├── equivalentthickness.m ├── flewoverbowtie.m ├── loadmaterial.m ├── materialdefine.m ├── matter │ ├── elements │ │ ├── Ac.csv │ │ ├── Ac.txt │ │ ├── Ag.csv │ │ ├── Ag.txt │ │ ├── Al.csv │ │ ├── Al.txt │ │ ├── Ar.csv │ │ ├── Ar.txt │ │ ├── As.csv │ │ ├── As.txt │ │ ├── At.csv │ │ ├── At.txt │ │ ├── Au.csv │ │ ├── Au.txt │ │ ├── B.csv │ │ ├── B.txt │ │ ├── Ba.csv │ │ ├── Ba.txt │ │ ├── Be.csv │ │ ├── Be.txt │ │ ├── Bi.csv │ │ ├── Bi.txt │ │ ├── Br.csv │ │ ├── Br.txt │ │ ├── C.csv │ │ ├── C.txt │ │ ├── Ca.csv │ │ ├── Ca.txt │ │ ├── Cd.csv │ │ ├── Cd.txt │ │ ├── Ce.csv │ │ ├── Ce.txt │ │ ├── Cl.csv │ │ ├── Cl.txt │ │ ├── Co.csv │ │ ├── Co.txt │ │ ├── Cr.csv │ │ ├── Cr.txt │ │ ├── Cs.csv │ │ ├── Cs.txt │ │ ├── Cu.csv │ │ ├── Cu.txt │ │ ├── Dy.csv │ │ ├── Dy.txt │ │ ├── Er.csv │ │ ├── Er.txt │ │ ├── Eu.csv │ │ ├── Eu.txt │ │ ├── F.csv │ │ ├── F.txt │ │ ├── Fe.csv │ │ ├── Fe.txt │ │ ├── Fr.csv │ │ ├── Fr.txt │ │ ├── Ga.csv │ │ ├── Ga.txt │ │ ├── Gd.csv │ │ ├── Gd.txt │ │ ├── Ge.csv │ │ ├── Ge.txt │ │ ├── H.csv │ │ ├── H.txt │ │ ├── He.csv │ │ ├── He.txt │ │ ├── Hf.csv │ │ ├── Hf.txt │ │ ├── Hg.csv │ │ ├── Hg.txt │ │ ├── Ho.csv │ │ ├── Ho.txt │ │ ├── HubbellTableI.csv │ │ ├── I.csv │ │ ├── I.txt │ │ ├── In.csv │ │ ├── In.txt │ │ ├── Ir.csv │ │ ├── Ir.txt │ │ ├── K.csv │ │ ├── K.txt │ │ ├── Kr.csv │ │ ├── Kr.txt │ │ ├── La.csv │ │ ├── La.txt │ │ ├── Li.csv │ │ ├── Li.txt │ │ ├── Lu.csv │ │ ├── Lu.txt │ │ ├── Mg.csv │ │ ├── Mg.txt │ │ ├── Mn.csv │ │ ├── Mn.txt │ │ ├── Mo.csv │ │ ├── Mo.txt │ │ ├── N.csv │ │ ├── N.txt │ │ ├── Na.csv │ │ ├── Na.txt │ │ ├── Nb.csv │ │ ├── Nb.txt │ │ ├── Nd.csv │ │ ├── Nd.txt │ │ ├── Ne.csv │ │ ├── Ne.txt │ │ ├── Ni.csv │ │ ├── Ni.txt │ │ ├── O.csv │ │ ├── O.txt │ │ ├── Os.csv │ │ ├── Os.txt │ │ ├── P.csv │ │ ├── P.txt │ │ ├── Pa.csv │ │ ├── Pa.txt │ │ ├── Pb.csv │ │ ├── Pb.txt │ │ ├── Pd.csv │ │ ├── Pd.txt │ │ ├── Pm.csv │ │ ├── Pm.txt │ │ ├── Po.csv │ │ ├── Po.txt │ │ ├── Pr.csv │ │ ├── Pr.txt │ │ ├── Pt.csv │ │ ├── Pt.txt │ │ ├── Ra.csv │ │ ├── Ra.txt │ │ ├── Rb.csv │ │ ├── Rb.txt │ │ ├── Re.csv │ │ ├── Re.txt │ │ ├── Rh.csv │ │ ├── Rh.txt │ │ ├── Rn.csv │ │ ├── Rn.txt │ │ ├── Ru.csv │ │ ├── Ru.txt │ │ ├── S.csv │ │ ├── S.txt │ │ ├── Sb.csv │ │ ├── Sb.txt │ │ ├── Sc.csv │ │ ├── Sc.txt │ │ ├── Se.csv │ │ ├── Se.txt │ │ ├── Si.csv │ │ ├── Si.txt │ │ ├── Sm.csv │ │ ├── Sm.txt │ │ ├── Sn.csv │ │ ├── Sn.txt │ │ ├── Sr.csv │ │ ├── Sr.txt │ │ ├── Ta.csv │ │ ├── Ta.txt │ │ ├── Tb.csv │ │ ├── Tb.txt │ │ ├── Tc.csv │ │ ├── Tc.txt │ │ ├── Te.csv │ │ ├── Te.txt │ │ ├── Th.csv │ │ ├── Th.txt │ │ ├── Ti.csv │ │ ├── Ti.txt │ │ ├── Tl.csv │ │ ├── Tl.txt │ │ ├── Tm.csv │ │ ├── Tm.txt │ │ ├── V.csv │ │ ├── V.txt │ │ ├── W.csv │ │ ├── W.txt │ │ ├── Xe.csv │ │ ├── Xe.txt │ │ ├── Y.csv │ │ ├── Y.txt │ │ ├── Yb.csv │ │ ├── Yb.txt │ │ ├── Zn.csv │ │ ├── Zn.txt │ │ ├── Zr.csv │ │ └── Zr.txt │ ├── getdatafromNIST.py │ ├── loadmaterialsample.m │ └── material │ │ ├── 93WNiFe.cfg │ │ ├── 97WNiFe.cfg │ │ ├── Alcohol.cfg │ │ ├── CorticalBone.cfg │ │ ├── CorticalBone_ICRP.cfg │ │ ├── Cranium.cfg │ │ ├── FAPbI3.cfg │ │ ├── Gd2O2S.cfg │ │ ├── HA.cfg │ │ ├── MAPbBr3.cfg │ │ ├── PE.cfg │ │ ├── PMMA.cfg │ │ ├── PVC.cfg │ │ ├── Sulfur.cfg │ │ ├── air.cfg │ │ ├── carbonfiber.cfg │ │ ├── crystalSi.cfg │ │ ├── foamedPE.cfg │ │ ├── graphite.cfg │ │ ├── metalAg.cfg │ │ ├── metalAl.cfg │ │ ├── metalCU.cfg │ │ ├── metalPb.cfg │ │ ├── metalTi.cfg │ │ ├── metalW.cfg │ │ ├── steel301.cfg │ │ ├── teflon.cfg │ │ ├── vacuum.cfg │ │ ├── water.cfg │ │ ├── water1100.cfg │ │ └── water2000.cfg ├── mergedetector.m ├── offfocalpseudoscan.m ├── offfocalpseudoscan2.m ├── photon2electron.m ├── projectinphantom.m ├── projectionscan.m ├── projectionscan2.m ├── projectionscan2b.m ├── scanprepare.m ├── spectrumresample.m ├── tube │ ├── 100kVp.csv │ ├── 120kVp.csv │ ├── 140kVp.csv │ ├── 70-150 │ │ ├── 100kVp.csv │ │ ├── 105kVp.csv │ │ ├── 110kVp.csv │ │ ├── 115kVp.csv │ │ ├── 120kVp.csv │ │ ├── 125kVp.csv │ │ ├── 130kVp.csv │ │ ├── 135kVp.csv │ │ ├── 140kVp.csv │ │ ├── 145kVp.csv │ │ ├── 150kVp.csv │ │ ├── 160kVp.csv │ │ ├── 70kVp.csv │ │ ├── 75kVp.csv │ │ ├── 80kVp.csv │ │ ├── 85kVp.csv │ │ ├── 90kVp.csv │ │ └── 95kVp.csv │ ├── 80kVp.csv │ ├── loadsourcespectrumsample.m │ ├── tube_spectrumdata2_v1.0.corr │ ├── tube_spectrumdata_60-150_v1.0.corr │ ├── tube_spectrumdata_60-160_v1.0.corr │ ├── tube_spectrumdata_70-150_v1.0.corr │ └── tube_spectrumdata_v1.0.corr └── weightofslicemerge.m ├── recon ├── external │ ├── reconnode_CRISAxialBackprojection.m │ ├── reconnode_CRISAxialFBP.m │ └── reconnode_CRISofffocalcali.m ├── lib │ ├── DFSmidchannel.m │ ├── QDOorder.m │ ├── TV │ │ ├── BregmanTV2D.m │ │ ├── BregmanTV2DL.m │ │ ├── BregmanTV2D_oneway.m │ │ ├── BregmanTV2D_tanh.m │ │ ├── BregmanTV2Db0.m │ │ ├── BregmanTV2Db1.m │ │ ├── BregmanTV2Db2.m │ │ ├── BregmanTV3D.m │ │ ├── BregmanTV3D_axialiter.m │ │ ├── BregmanTV3D_helicaliter.m │ │ ├── BregmanTV3D_tanh.m │ │ ├── BregmanTV_Z.m │ │ ├── GlogTV1D.m │ │ ├── GlogTV1D2.m │ │ ├── LaplacedTV1D.m │ │ ├── LaplacedTV1D2.m │ │ ├── LaplacianSmooth_3Dtanh.m │ │ └── TVoptions.m │ ├── ZetaEta2TzTable.m │ ├── Zupsamplingprepare.m │ ├── aircorrection │ │ ├── aircorrwithoutref.m │ │ ├── airrefcorr.m │ │ ├── airreference.m │ │ ├── intensityaircorr.m │ │ ├── isrefblocked.m │ │ └── referencecorr.m │ ├── antiringonhelical.m │ ├── antiringonimage.m │ ├── axialchordhomeomorph.m │ ├── axialconehomeomorph.m │ ├── backprojection │ │ ├── axial3Dprepare.m │ │ ├── cradleprepare.m │ │ ├── helicalbpinterp.m │ │ ├── helicalprepare.m │ │ └── helicalviewexta.m │ ├── bonecorrEdgeEnhance.m │ ├── bonecorrEdgeEnhance3D.m │ ├── commonbpprepare.m │ ├── detpos2angle.m │ ├── detpos2fanangles.m │ ├── doubleup.m │ ├── doubleup2.m │ ├── doubleupbutterfly.m │ ├── filterdesign.m │ ├── fpprepare.m │ ├── getBoneImg.m │ ├── getDicominfo.m │ ├── helicalrthetainv.m │ ├── helicalrthetatrans.m │ ├── idealfanangles.m │ ├── imagereorder.m │ ├── loadboneharden.m │ ├── loadfilter.m │ ├── ntimesup.m │ ├── ntimesupmatrix.m │ ├── offfocal │ │ ├── offfocalsinckernel.m │ │ ├── offfocalzcross.m │ │ └── offfocalzcrossmatrix.m │ ├── omiga4interp.m │ ├── omiga4table.m │ ├── rebin │ │ ├── rebinprepare.m │ │ └── sloperebinprepare.m │ ├── recon │ │ ├── initialimagehead.m │ │ └── reconimagehead.m │ ├── rthetainv.m │ └── rthetatrans.m ├── nodes │ ├── loadcalitables.m │ ├── pipelineinitial.m │ ├── reconinitial.m │ ├── reconnode_Antiring.m │ ├── reconnode_Antiwindmill.m │ ├── reconnode_Axial2DBackprojection.m │ ├── reconnode_Axial3DBackprojection.m │ ├── reconnode_Axialrebin.m │ ├── reconnode_Backprojection.m │ ├── reconnode_Filter.m │ ├── reconnode_HelicalBackprojection.m │ ├── reconnode_HelicalPiLineBP.m │ ├── reconnode_Helicalrebin.m │ ├── reconnode_Rebin.m │ ├── reconnode_Rowcombine.m │ ├── reconnode_aircali.m │ ├── reconnode_aircorr.m │ ├── reconnode_badchannelcorr.m │ ├── reconnode_ballcali.m │ ├── reconnode_beamhardencali.m │ ├── reconnode_beamhardencorr.m │ ├── reconnode_bonehardencali.m │ ├── reconnode_bonehardencorr.m │ ├── reconnode_crosstalkcali.m │ ├── reconnode_crosstalkcorr.m │ ├── reconnode_detectorcali.m │ ├── reconnode_fananglecorr.m │ ├── reconnode_hounsefieldcorr.m │ ├── reconnode_idealwater.m │ ├── reconnode_inverserebin.m │ ├── reconnode_log2.m │ ├── reconnode_nonlinearcali.m │ ├── reconnode_nonlinearcorr.m │ ├── reconnode_offfocalcali.m │ ├── reconnode_offfocalcorr.m │ ├── reconnode_readrawdata.m │ ├── reconnode_referencecorr.m │ └── reconnode_watergoback.m ├── nodesentry.m ├── pipelinelib │ ├── allpurposenodes │ │ ├── allpurposefakekernel.m │ │ └── fakenodereadrawdata.m │ ├── branchpooltrace.m │ ├── combinenodes.m │ ├── defaultpipelineprepare.m │ ├── indexinoutmap.m │ ├── initialpool.m │ ├── inputbranchpool.m │ ├── movepointsaftercopy.m │ ├── nodepoststep.m │ ├── nodepriostep.m │ ├── nodestatecheck.m │ ├── outputbranchpool.m │ ├── pipereadingnumer.m │ ├── poolclear.m │ ├── pooldatacopy.m │ ├── pooldataoutput.m │ ├── poolhardcopy.m │ ├── poolindex.m │ ├── poolmirror.m │ ├── poolpriostep.m │ ├── poolpspaceleft.m │ ├── poolreadable.m │ ├── poolrecycle.m │ ├── poolrecycle2.m │ ├── poolresize.m │ ├── pooltrace.m │ └── we shall move the pool things to a class.txt ├── prepare │ ├── reconnode_airprepare.m │ ├── reconnode_allpurposeprepare.m │ ├── reconnode_antiringprepare.m │ ├── reconnode_antiwindmillprepare.m │ ├── reconnode_axial3dbackprojectionprepare.m │ ├── reconnode_axialrebinprepare.m │ ├── reconnode_backprojectionprepare.m │ ├── reconnode_backprojectionrestart.m │ ├── reconnode_badchannelprepare.m │ ├── reconnode_databufferprepare.m │ ├── reconnode_dataoutputprepare.m │ ├── reconnode_datareloadprepare.m │ ├── reconnode_donothingprepare.m │ ├── reconnode_fanangleprepare.m │ ├── reconnode_filterprepare.m │ ├── reconnode_helicalbackprojectionprepare.m │ ├── reconnode_helicalbackprojectionrestart.m │ ├── reconnode_helicalrebinprepare.m │ ├── reconnode_loadrawdataprepare.m │ ├── reconnode_loadrawdatarestart.m │ ├── reconnode_log2prepare.m │ ├── reconnode_multiaxialmeanprepare.m │ ├── reconnode_offfocalprepare.m │ ├── reconnode_pipelineprepare.m │ ├── reconnode_pipelinerestart.m │ ├── reconnode_pipelinestuckprepare.m │ ├── reconnode_rebinprepare.m │ ├── reconnode_rebinrestart.m │ ├── reconnode_referenceprepare.m │ └── reconnode_upsampleprepare.m ├── recon_access.m └── supportnodes │ ├── reconnode_Systemconfigure.m │ ├── reconnode_allpurpose.m │ ├── reconnode_corrclear.m │ ├── reconnode_corrdrawback.m │ ├── reconnode_corrredirect.m │ ├── reconnode_databackup.m │ ├── reconnode_databuffer.m │ ├── reconnode_dataclear.m │ ├── reconnode_datadelete.m │ ├── reconnode_datamean.m │ ├── reconnode_dataoutput.m │ ├── reconnode_datareload.m │ ├── reconnode_disguiser.m │ ├── reconnode_donothing.m │ ├── reconnode_error.m │ ├── reconnode_flow2workspace.m │ ├── reconnode_funhandle.m │ ├── reconnode_multiaxialmean.m │ ├── reconnode_null.m │ ├── reconnode_pipelinedatamove.m │ ├── reconnode_pipelinestuck.m │ ├── reconnode_simulation.m │ └── reconnode_sleep.m ├── scripts ├── BoneBHCorrectionScript_3Dfit.m ├── BoneBHCorrectionScript_surffit.m ├── BoneBHcali_script.m ├── BoneBHcali_script_ForSimudata.m ├── _to release informal workflows in here ├── aircali_script.m ├── airrepeat_script.m ├── bnc3in1cali_dataprepare.m ├── bnc3in1cali_step1.m ├── bnc3in1cali_step2.m ├── bnc3in1cali_step2_70KV.m ├── bnc3in1cali_step2_bk.m ├── bnc3in1cali_step2_crs1.m ├── bnc3in1cali_step2_crs2.m ├── bnc3in1cali_step3.m ├── bnc3in1cali_step3_70KV.m ├── bowtieframe_script.m ├── corrformatbase_script.m ├── cutshots_script.m ├── detectorframe_script.m ├── nonliearcali_script.m ├── nonlinearcali_script.m ├── pincali_script.m ├── projection_script.m ├── rawdataframe_script.m ├── recon_script_demo.m ├── systemconfigure_script.m ├── tubeframe_script.m └── zmappalette_script.m ├── system ├── collimatorexposure.m ├── configureclean.m ├── datapath │ ├── corrtableoutput.m │ ├── rawdataoutput.m │ ├── reconxmloutput.m │ └── simuresultsoutput.m ├── detectorextracollim.m ├── initialGPU.m ├── initialstatus.m ├── loadmodconfig.m ├── loadprotocol.m ├── materialconfigure.m ├── mod │ ├── BoneBH_configure.xml │ ├── bowtieframe │ │ ├── bowtie_sample_v1.0.corr │ │ ├── bowtiecurvesample.m │ │ └── bowtiesample.m │ ├── console │ │ ├── sample_corrcouplerule.xml │ │ ├── sample_corrcouplerule2.xml │ │ ├── sample_filenamerule.xml │ │ └── sample_filenamerule2.xml │ ├── detectorframe │ │ ├── collimatorexplain_unit24.xml │ │ ├── collimatorexplain_unit64.xml │ │ ├── detector_sample_unit16.corr │ │ ├── detector_sample_unit24.corr │ │ ├── detector_sample_unit64_v1.0.corr │ │ ├── detector_sample_v1.0.corr │ │ ├── detectorframe.rar │ │ ├── detectorpos_ideal_1000.mat │ │ └── idealdetector.m │ ├── phantom │ │ ├── phantom_Cublade1mm.xml │ │ ├── phantom_Head_Cranium_170_center.xml │ │ ├── phantom_Head_Cranium_170_center_10mm.xml │ │ ├── phantom_Head_Cranium_170_center_4mm.xml │ │ ├── phantom_Head_Cranium_170_center_8mm.xml │ │ ├── phantom_air.xml │ │ ├── phantom_heart_of_oak.json │ │ ├── phantom_heart_of_oak.xml │ │ ├── phantom_shellwater200_center.xml │ │ ├── phantom_shellwater200_off120.xml │ │ ├── phantom_shellwater200_off90.xml │ │ ├── phantom_shellwater300_center.xml │ │ ├── phantom_shellwater300_off120.xml │ │ ├── phantom_shellwater300_off90.xml │ │ ├── phantom_stealball.xml │ │ ├── phantom_water200_center.xml │ │ ├── phantom_water200_off20.xml │ │ ├── phantom_water200_off90.xml │ │ ├── phantom_water300_center.xml │ │ └── phantom_water300_off90.xml │ ├── phantom_water.xml │ ├── protocol │ │ ├── sample_protocol_Axial.xml │ │ └── sample_protocol_Helical.xml │ ├── rawdataframe │ │ ├── rawdata_sample.raw │ │ ├── rawdata_sample0.raw.xml │ │ └── rawdata_sample1.raw.xml │ ├── recon │ │ ├── iteration │ │ │ ├── reconAxialiter_configure_samp.xml │ │ │ ├── reconHelicaliter_configure_samp.xml │ │ │ ├── recon_Axial_Iteration_old.xml │ │ │ └── recon_Helical_Iteration_old.xml │ │ ├── recon_Axial_sample.xml │ │ ├── recon_Axial_sample2.xml │ │ ├── recon_Helical_sample.xml │ │ ├── recon_Helical_sample2.xml │ │ └── reconsystem_sample.xml │ ├── sample_configure.xml │ ├── sample_configure_expand.xml │ ├── sample_output_configure.xml │ ├── sample_phantom.json │ ├── sample_phantom.xml │ ├── sample_protocol.xml │ └── sample_system.xml ├── nametagrule.m ├── phantomcfgsample.m ├── phantomconfigure.m ├── protocol2nametag.m ├── protocolcfgsample.m ├── protocolconfigure.m ├── systemcfgsample.m ├── systemconfigure.m └── systemprepare.m └── tools ├── almostlsq.m ├── backup ├── struct2xml_backup1.m └── xml2struct_backup1.m ├── castuint8.m ├── classGPU.m ├── classsize.m ├── cleaninputarg.m ├── cttool.m ├── cttool ├── +cttool │ ├── +iptui │ │ ├── +internal │ │ │ ├── myfilterWorkspaceVars.m │ │ │ └── myimgetvar.m │ │ └── imagePage.m │ ├── cttool.m │ ├── imcttool.m │ ├── myimcontrast.m │ └── myimdisplayrange.m ├── +cttool_2016 │ ├── +iptui │ │ ├── +internal │ │ │ ├── myfilterWorkspaceVars.m │ │ │ └── myimgetvar.m │ │ └── imagePage.m │ ├── cttool.m │ ├── imcttool.m │ ├── imdisplayrange.m │ ├── myimcontrast.m │ └── myimdisplayrange.m └── images │ ├── leftarrow.png │ └── rightarrow.png ├── curves ├── acot2.m ├── hardentanh.m ├── hardentanh2.m ├── mylorenzcurve.m └── slidecurve.m ├── everything2real.m ├── everything2single.m ├── fileposorgtoend.m ├── findfield.m ├── findfields.m ├── gaussblur.m ├── getstructptr.m ├── gpuArraygroup.m ├── hsl2hsv.m ├── hsl2rgb.m ├── ilovedot.m ├── imagedown.m ├── imageup2.m ├── imageupn.m ├── imageupnGPU.m ├── interpprepare.m ├── isFFF.m ├── isavail.m ├── lgwt.m ├── lgwt_license.txt ├── linkstringcell.m ├── natsort.m ├── natsortfiles.m ├── putfieldsinGPU.m ├── putinGPU.m ├── real2complex.m ├── splaplace2D.m ├── splitcomma.m ├── struct2ptr.m ├── structcellcurse.m ├── structcompare.m ├── structmerge.m ├── structregexprep.m ├── structstrreplace.m ├── tac.m ├── uint8cast.m ├── whatisfft.m └── xml2json.m /.gitignore: -------------------------------------------------------------------------------- 1 | /CRISrecon.m 2 | /IO/external/*/ 3 | /advance/* 4 | /test/* 5 | /CUDA/* 6 | 7 | # ---> MATLAB 8 | # Windows default autosave extension 9 | *.asv 10 | 11 | # OSX / *nix default autosave extension 12 | *.m~ 13 | 14 | # Compiled MEX binaries (all platforms) 15 | *.mex* 16 | 17 | # Packaged app and toolbox files 18 | *.mlappinstall 19 | *.mltbx 20 | 21 | # Generated helpsearch folders 22 | helpsearch*/ -------------------------------------------------------------------------------- /IO/cleanpath.m: -------------------------------------------------------------------------------- 1 | function configure = cleanpath(configure, mainpath, escapepath) 2 | % clean the pathes 3 | 4 | if nargin < 3 5 | escapepath = 'system.path'; 6 | end 7 | 8 | % to replace relative pathes ~/ and ~\ by mainpath 9 | configure = structregexprep(configure, '~(/|\\)', regexptranslate('escape', mainpath)); 10 | % to replace relative pathes $pathname$ by configure.system.path.(pathname) 11 | configure = structregexprep(configure, '\$(\w*)(?=(\\|/))', ['${regexptranslate(''escape'', root.' escapepath '.($1))}']); 12 | % kown bug: \. -> . , \- -> - 13 | configure = structregexprep(configure, '\\([\-,\.])', '$1'); 14 | % kown bug: \ -> \\ 15 | configure = structregexprep(configure, '(?!^)\\+', '\\'); 16 | 17 | end -------------------------------------------------------------------------------- /IO/decodenumber.m: -------------------------------------------------------------------------------- 1 | function r = decodenumber(c, Sorig, Sprev) 2 | % a subfunction to explain the numers in cfg_ii.size and cfg_ii.number used in sparsepack.m and packstruct.m 3 | 4 | if nargin < 3 5 | Sprev = Sorig; 6 | end 7 | 8 | if isnumeric(c) 9 | r = c; 10 | elseif isempty(c) 11 | r = []; 12 | elseif ischar(c) 13 | % c(c=='$') = 'S'; 14 | c = regexprep(c, '\$\$' , 'Sorig'); 15 | c = regexprep(c, '\$' , 'Sprev'); 16 | try 17 | r = eval(c); 18 | catch 19 | r = c; 20 | end 21 | else 22 | r = nan; 23 | end 24 | % to double 25 | if isnumeric(r) 26 | r = double(r); 27 | end 28 | 29 | end -------------------------------------------------------------------------------- /IO/external/extrernal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/IO/external/extrernal -------------------------------------------------------------------------------- /IO/general/jsonread.m: -------------------------------------------------------------------------------- 1 | function jstruct = jsonread(fname) 2 | % read json file 3 | 4 | f1 = fopen(fname, 'r'); 5 | charf1 = fread(f1, inf, 'char=>char'); 6 | fclose(f1); 7 | jstruct = jsondecode(charf1(:)'); 8 | -------------------------------------------------------------------------------- /IO/general/jsonwrite.m: -------------------------------------------------------------------------------- 1 | function jschar = jsonwrite(jstruct, fname) 2 | % write json file 3 | % jschar = jsonwrite(jstruct, fname); 4 | 5 | jstruct = jsonclear(jstruct); 6 | jschar = jsonformat(jsonencode(jstruct)); 7 | 8 | if nargin > 1 9 | f1 = fopen(fname, 'w'); 10 | if f1>=0 11 | fwrite(f1, jschar); 12 | end 13 | if f1>=3 14 | fclose(f1); 15 | end 16 | end 17 | 18 | end 19 | 20 | function S = jsonclear(S) 21 | 22 | for fields = fieldnames(S)' 23 | if isgpuarray(S.(fields{1})) 24 | S.(fields{1}) = gather(S.(fields{1})); 25 | end 26 | if isstruct(S.(fields{1})) 27 | for ii = 1:length(S.(fields{1})(:)) 28 | S.(fields{1})(ii) = jsonclear(S.(fields{1})(ii)); 29 | end 30 | elseif iscell(S.(fields{1})) 31 | for ii = 1:length(S.(fields{1})(:)) 32 | S.(fields{1}){ii} = jsonclear(S.(fields{1}){ii}); 33 | end 34 | else 35 | switch class(S.(fields{1})) 36 | case 'function_handle' 37 | S.(fields{1}) = char(S.(fields{1})); 38 | otherwise 39 | end 40 | end 41 | end 42 | 43 | end -------------------------------------------------------------------------------- /IO/loadbindata.m: -------------------------------------------------------------------------------- 1 | function [datastruct, cfg] = loadbindata(datafile, cfgfile, warnonoff) 2 | % load bin data file 3 | 4 | if nargin<3 5 | warnonoff = true; 6 | end 7 | 8 | if isstruct(cfgfile) 9 | cfg = cfgfile; 10 | elseif isfile(cfgfile) 11 | cfg = readcfgfile(cfgfile); 12 | elseif exist(cfgfile, 'file') 13 | if warnonoff 14 | warning('To load configure file in MATLAB search path! It might be unsafe.'); 15 | end 16 | cfg = readcfgfile(cfgfile); 17 | else 18 | error('Can not open the cfgfile!'); 19 | end 20 | 21 | fid = fopen(datafile, 'r'); 22 | 23 | datastruct = sparsepack(fid, cfg); 24 | fclose(fid); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /IO/loaddicomimg.m: -------------------------------------------------------------------------------- 1 | function [img, dcminfo] = loaddicomimg(filepath, dcmext) 2 | % [img, dcminfo] = loaddicomimg(filepath, toclass) 3 | % load dicom image(s) 4 | 5 | if nargin<2 6 | dcmext = '.dcm'; 7 | end 8 | 9 | if isfile(filepath) 10 | % read file 11 | dcminfo = dicominfo(filepath); 12 | img = dicomread(filepath); 13 | % to float 14 | img = single(img); 15 | % scale 16 | if isfield(dcminfo, 'RescaleIntercept') 17 | img = img.*dcminfo.RescaleSlope + dcminfo.RescaleIntercept + 1000; 18 | end 19 | elseif isfolder(filepath) 20 | [img, dcminfo] = loaddcmimage2(filepath, dcmext); 21 | else 22 | img = []; 23 | dcminfo = []; 24 | end 25 | end 26 | 27 | 28 | function [img, dcminfo] = loaddcmimage2(imgpath, dcmext) 29 | 30 | if nargin<2 31 | dcmext = '.dcm'; 32 | end 33 | 34 | files = dir(fullfile(imgpath, [ '*' dcmext])); 35 | [~, sortidx] = natsortfiles({files.name}); 36 | files = files(sortidx); 37 | Nf = size(files(:), 1); 38 | 39 | img = []; 40 | dcminfo = []; 41 | for ii = 1:Nf 42 | [img_ii, dcminfo_ii] = loaddicomimg(fullfile(files(ii).folder, files(ii).name)); 43 | img = cat(4, img, img_ii); 44 | dcminfo = [dcminfo, dcminfo_ii]; 45 | end 46 | 47 | end -------------------------------------------------------------------------------- /IO/readcfgfile.m: -------------------------------------------------------------------------------- 1 | function cfg = readcfgfile(cfgfile) 2 | 3 | cfgfile = char(cfgfile); 4 | if exist(cfgfile, 'file') 5 | [~, ~, cfgext] = fileparts(cfgfile); 6 | switch cfgext 7 | case '.xml' 8 | root = myxml2struct(cfgfile); 9 | name = fieldnames(root); 10 | cfg = root.(name{1}); 11 | case '.json' 12 | root = jsonread(cfgfile); 13 | name = fieldnames(root); 14 | cfg = root.(name{1}); 15 | case '.mat' 16 | cfg = load(cfgfile); 17 | otherwise 18 | error(['Unknown file type ', cfgext]); 19 | end 20 | else 21 | error(['File not exist, ', cfgfile]); 22 | end -------------------------------------------------------------------------------- /IO/standard/bowtie_corr_v1.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | Struct 5 | 6 | 1 7 | 8 | 0 9 | Uint8 10 | 4 11 | 1 12 | 13 | 14 | 4 15 | Single 16 | 3 17 | 4 18 | 19 | 20 | 16 21 | Single 22 | 1 23 | 4 24 | 25 | 26 | 20 27 | Uint32 28 | 1 29 | 4 30 | 31 | 32 | 24 33 | Uint32 34 | 1 35 | 4 36 | 37 |
38 | 512 39 | Single 40 | $.Nsample*($.Ncurve+1) 41 | 4 42 |
43 |
-------------------------------------------------------------------------------- /IO/standard/corrbase.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | Struct 5 | 6 | 1 7 | 8 | 0 9 | Uint8 10 | 4 11 | 1 12 | 13 | -------------------------------------------------------------------------------- /IO/standard/rawdatabase.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | Struct 5 | 6 | 1 7 | 8 | 0 9 | Uint64 10 | 1 11 | 8 12 | 13 | 14 | 8 15 | Uint8 16 | 1 17 | 1 18 | 19 | 20 | 9 21 | Uint8 22 | 1 23 | 1 24 | 25 | 26 | 10 27 | Uint8 28 | 2 29 | 1 30 | 31 | -------------------------------------------------------------------------------- /IO/standard/tube_corr_v1.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | Struct 5 | 6 | 1 7 | 8 | 0 9 | Uint8 10 | 4 11 | 1 12 | 13 | 14 | 4 15 | Single 16 | 4 17 | 4 18 | 19 | 20 | 20 21 | Single 22 | 1 23 | 4 24 | 25 | 26 | 24 27 | Uint32 28 | 1 29 | 4 30 | 31 | 32 | 28 33 | Single 34 | $.KVnumber 35 | 4 36 | 37 | 38 | 28+$.KVnumber*4 39 | Uint32 40 | 1 41 | 4 42 | 43 |
44 | 512 45 | Single 46 | $.Nsample*$.KVnumber*2 47 | 4 48 |
49 |
-------------------------------------------------------------------------------- /IO/struct2binfile.m: -------------------------------------------------------------------------------- 1 | function struct2binfile(S, filename, cfgtype) 2 | 3 | if nargin<3 4 | cfgtype = 'xml'; 5 | end 6 | 7 | cfg = structbincfg(S); 8 | [data, ~] = packstruct(S, cfg); 9 | 10 | % output data file 11 | fid = fopen(filename,'w'); 12 | fwrite(fid, data, 'uint8'); 13 | fclose(fid); 14 | 15 | root = struct(); 16 | root.(inputname(1)) = cfg; 17 | [pathstr, name, ~] = fileparts(filename); 18 | switch cfgtype 19 | case 'xml' 20 | xmlfile = fullfile(pathstr,[name '.xml']); 21 | struct2xml(root, xmlfile); 22 | case 'json' 23 | jsonfile = fullfile(pathstr,[name '.json']); 24 | jsonwrite(root, jsonfile); 25 | otherwise 26 | 1; 27 | end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Dier Zhang 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CT-simulation 2 | # /doc/UserGuide.html 3 | -------------------------------------------------------------------------------- /cali/calixml/Aircali_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | tobefill 5 | .\IO\standard\ 6 | D:\matlab\Data\cali\ 7 | D:\matlab\CTsimulation\system\mod\recon\reconsystem_sample.xml 8 | 9 | 1 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | air_v1.0 19 | manutags 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /cali/calixml/Zcali_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | tobefill 5 | .\IO\standard\ 6 | D:\matlab\Data\cali\ 7 | D:\matlab\CTsimulation\system\mod\recon\reconsystem_sample.xml 8 | 9 | 1 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /cali/calixml/corrcouple_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1.5SecpRot 10 | 2SecpRot 11 | 12 | 13 | 0.5SecpRot, 0.8SecpRot 14 | 1SecpRot 15 | 16 | 17 | 18 | 19 | 20 | 21 | large, small 22 | 23 | 24 | 16x0.625 25 | 32x0.625 26 | 27 | 28 | 8x0.625, 4x0.625 29 | 16x0.625, 32x0.625 30 | 31 | 32 | 16x1.25, 8x1.25 33 | 32x0.625 34 | 35 | 36 | 4x1.25 37 | 8x1.25, 16x1.25, 32x0.625 38 | 39 | 40 | -------------------------------------------------------------------------------- /cali/calixml/protocol_beamharden.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 5 | Static 6 | All 7 | Empty 8 | 1 9 | 1 10 | 80 100 120 140 11 | 300 12 | 300 13 | 1152 14 | 0 15 | 0 16 | 1152 17 | 500 18 | 0 19 | 0 20 | 1 21 | 0 22 | 0 23 | 0 24 | bhcali 25 | mat 26 | 27 | 28 | Body 29 | 30 | 31 | Head 32 | 33 | -------------------------------------------------------------------------------- /cali/calixml/protocol_nonlinear.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 5 | Axial 6 | 16x1.0 7 | Body 8 | 1 9 | 1 10 | 120 11 | 300 12 | 30 13 | 1440 14 | 1 15 | 1 16 | 17 | 0 18 | 0 19 | 1 20 | 0 21 | 0 22 | 0 23 | nlcali 24 | mat 25 | 26 | 27 | Head 28 | 29 | -------------------------------------------------------------------------------- /cali/experiment/loadraw_scp2.m: -------------------------------------------------------------------------------- 1 | % load raw 2 | 3 | rawpath = 'D:\data\taiying\CU\'; 4 | dirpath = dir(fullfile(rawpath, '*.raw')); 5 | 6 | % Data files 7 | Data = struct(); 8 | index = 1; 9 | for ii=1:length(dirpath(:)) 10 | 11 | Data(index).filename = fullfile(dirpath(ii).folder, dirpath(ii).name); 12 | [~, filename_tags, ~] = fileparts(Data(index).filename); 13 | namekey = regexp(filename_tags, '_', 'split'); 14 | % I know the keys are: 15 | Data(index).object = namekey{end}; 16 | KV = regexp(namekey, '\d+(kv|KV)','match'); 17 | KV = KV{~cellfun(@isempty, KV)}; 18 | Data(index).KV = str2double(KV{1}(1:end-2)); 19 | mA = regexp(namekey, '\d+ma','match'); 20 | mA = mA{~cellfun(@isempty, mA)}; 21 | Data(index).mA = str2double(mA{1}(1:end-2)); 22 | % Data(index).bowtie = namekey{3}; 23 | % Data(index).focal = namekey{3}; 24 | % 2019/11/21 25 | index = index + 1; 26 | end 27 | 28 | % load data 29 | rawcfgfile = 'D:\matlab\ct\BCT16\IOstandard\rawdata_v1.0.xml'; 30 | for ii = 1:length(Data) 31 | fprintf('Reading %s ...', Data(ii).filename); 32 | raw_ii = loadbindata(Data(ii).filename, rawcfgfile); 33 | Nskip = 100; 34 | Data(ii).rawmean = mean([raw_ii(Nskip+1:end).Raw_Data], 2); 35 | fprintf('done\n'); 36 | end 37 | -------------------------------------------------------------------------------- /cali/experiment/spectfitfun.m: -------------------------------------------------------------------------------- 1 | function [r, resp] = spectfitfun(x, Dp, Dair, spectrange, samplekeV, mu_ref, Dtarg, lambda) 2 | 3 | % x = normr(x); 4 | % xt = [0; abs(x(:))]; 5 | % xt = [0; x(:)]; 6 | xt = x(:); 7 | Nx = length(xt); 8 | t = linspace(spectrange(1), spectrange(2), Nx); 9 | % cs = spline(t, xt); 10 | % r2 = ppval(cs, C.samplekeV(:)); 11 | resp = pchip(t, xt, samplekeV(:)); 12 | resp(samplekeV(:) 7 20 | rr = resp(2:end-1).*2 - resp(1:end-2) - resp(3:end); 21 | r = [r; sum(rr.^2)./sum(resp.^2).*length(resp).*lambda]; 22 | end 23 | 24 | end -------------------------------------------------------------------------------- /cali/experiment/testdata/response_1219.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/cali/experiment/testdata/response_1219.mat -------------------------------------------------------------------------------- /cali/focalspot20x.m: -------------------------------------------------------------------------------- 1 | function focalspot_0x = focalspot20x(focalspot) 2 | % to explain the focalspot in protocol 3 | % focalspot_0x = focalspot20x(focalspot); 4 | % QFS: 0x10000000 (left end) 5 | % DFS: 0x01100000 6 | 7 | if isnumeric(focalspot) 8 | focalspot_0x = focalspot; 9 | else 10 | switch upper(focalspot) 11 | case 'QFS' 12 | % the 1st focal spot 13 | focalspot_0x = 1; % 0x10000000 14 | case {'DFS', 'XDFS'} 15 | % flying between 2nd and 3rd focal sopt 16 | focalspot_0x = 6; % 0x01100000 17 | case {'ZDFS'} 18 | % flying between 4th and 5th focal sopt 19 | focalspot_0x = 24; % 0x00011000 20 | otherwise 21 | % unknown focal spot 22 | focalspot_0x = 0; 23 | end 24 | end 25 | 26 | focalspot_0x = uint16(focalspot_0x); 27 | 28 | end -------------------------------------------------------------------------------- /cali/lib/invpolyval.m: -------------------------------------------------------------------------------- 1 | function x = invpolyval(p, y, x0, lrb, tol, Nmax) 2 | % find x: y = polyval(p, x); 3 | % x = invpolyval(p, y); 4 | 5 | if nargin<3 || isempty(x0) 6 | x0 = (y-p(end))./p(end-1); 7 | x0 = fillmissing(x0, 'constant', 0); 8 | end 9 | if nargin<4 10 | lrb = []; 11 | end 12 | if nargin<5 13 | tol = 1e-6; 14 | end 15 | if nargin<6 16 | Nmax = 100; 17 | end 18 | 19 | 20 | % debug 21 | % xc = fzero(@(x) polyval(p, x)-y, x0); 22 | 23 | p = p(:)'; 24 | Np = length(p); 25 | dp = (Np-1:-1:1).*p(1:end-1); 26 | 27 | alpha = 1.0; 28 | 29 | r0 = fillmissing((y-polyval(p, x0))./polyval(dp, x0), 'constant', 0); 30 | x = x0; 31 | r = r0; 32 | 33 | for ii = 1:Nmax 34 | x = x + r.*alpha; 35 | rr = r.^2; 36 | if all(rrylr(2); 54 | x(s2) = lrb(2) + (y(s2)-ylr(2))./dlr(2); 55 | end 56 | 57 | end -------------------------------------------------------------------------------- /cali/lib/iterinvpolyval.m: -------------------------------------------------------------------------------- 1 | function y = iterinvpolyval(p, x, r, n) 2 | % return y satisfy ((((y*p(1)+1)*y*p(2)+1)*y*p(3)+1)*...)y*p(n) = x 3 | % y = iterinvpolyval(p, x, r, n); 4 | 5 | if nargin<3 6 | r = [min(x(:)./p(end)).*0.8 max(x(:)./p(end)).*1.2]; 7 | end 8 | if nargin<4 9 | n = 1000; 10 | end 11 | 12 | yy = linspace(r(1), r(2), n); 13 | xx = iterpolyval(p, yy); 14 | y = interp1(xx, yy, x, 'linear', 'extrap'); 15 | 16 | end -------------------------------------------------------------------------------- /cali/lib/iterpolyval.m: -------------------------------------------------------------------------------- 1 | function y = iterpolyval(p, x) 2 | % return y = ((((x*p(1)+1)*x*p(2)+1)*x*p(3)+1)*...)*x*p(n) 3 | % y = iterpolyval(p, x); 4 | 5 | n = size(p, 2); 6 | y = ones(size(x)); 7 | for ii = 1:n-1 8 | y = (y.*x).*p(:, ii) + 1.0; 9 | end 10 | y = (y.*x).*p(:, n); 11 | 12 | end -------------------------------------------------------------------------------- /cali/lib/pinleftoptmatrix.m: -------------------------------------------------------------------------------- 1 | function [A, L, indexrange] = pinleftoptmatrix(cs, Npixel, Nslice, Nview, Npixelpermod, alpha) 2 | % subroutine used in geometric cali 3 | 4 | A = cell(Nslice, 1); 5 | indexrange = zeros(Nslice, 2); 6 | for islice = 1:Nslice 7 | pindex = [cs(islice, :).pindex]; 8 | vindex = [cs(islice, :).vindex]; 9 | A{islice} = sparse(vindex, pindex, double([cs(islice, :).dp]), Nview, Npixel); 10 | % cut edge 11 | edge1 = (ceil(min(pindex)/Npixelpermod) + 2)*Npixelpermod + 1; 12 | edge2 = (floor(max(pindex)/Npixelpermod) - 2)*Npixelpermod; 13 | indexrange(islice, :) = [edge1, edge2]; 14 | % A{islice} = A{islice}(:, p1:p2); 15 | end 16 | 17 | % dgA = zeros(Npixel, Nslice); 18 | % L = spdiags(ones(Npixel, 1)*[-1 2 1], [-1 0 1], Npixel, Npixel); 19 | Nmod = Npixel/Npixelpermod; 20 | Lmod = cell(1, Nmod); 21 | Lvalue = repmat([-1/2 1 -1/2], Npixelpermod, 1); 22 | Lvalue(1, 2) = 1/2; Lvalue(end, 2) = 1/2; 23 | Lmod(:) = {spdiags(Lvalue, [-1 0 1], Npixelpermod, Npixelpermod)}; 24 | Lall = spdiags(repmat([-1/2 1 -1/2], Npixel, 1), [-1 0 1], Npixel, Npixel); 25 | Lall(1, 1) = 1/2; Lall(end, end) = 1/2; 26 | alpha_mod = alpha(1)-alpha(2); alpha_all = alpha(2); 27 | L = blkdiag(Lmod{:}).*alpha_mod + Lall.*alpha_all; 28 | end -------------------------------------------------------------------------------- /cali/lib/polyval2dm.m: -------------------------------------------------------------------------------- 1 | function R = polyval2dm(P, X, Y) 2 | % 2D polyvalm 3 | % R = polyval2dm(P, X, Y); 4 | % R = P(1,1) + P(2,1)*X + P(2,2)*X*Y + P(1,2)*Y + ... + P(m+1,n+1)*X^m*Y^n. 5 | 6 | [m, n] = size(P); 7 | 8 | R = zeros(size(X), 'like', X); 9 | for ix = m:-1:1 10 | yy = P(ix, n); 11 | for iy = n-1:-1:1 12 | yy = yy.*Y + P(ix, iy); 13 | end 14 | R = R.*X + yy; 15 | end 16 | 17 | end -------------------------------------------------------------------------------- /cali/lib/polyval3dm.m: -------------------------------------------------------------------------------- 1 | function R = polyval3dm(P, X, Y, Z) 2 | % 3D polyvalm 3 | % R = polyval3dm(P, X, Y, Z); 4 | % R = P(1,1,1) + P(2,1,1)*X + P(1,2,1)*Y + P(1,1,2)*Z + ... + P(m+1,n+1,q+1)*X^m*Y^n*Z^q. 5 | 6 | [m, n, q] = size(P); 7 | R = zeros(size(X), 'like', X); 8 | yy = zeros(size(X), 'like', X); 9 | for ix = m:-1:1 10 | yy = yy.*0; 11 | for iy = n:-1:1 12 | zz = P(ix, iy, q); 13 | for iz = q-1:-1:1 14 | zz = zz.*Z + P(ix, iy, iz); 15 | end 16 | yy = yy.*Y + zz; 17 | end 18 | R = R.*X + yy; 19 | end 20 | 21 | end -------------------------------------------------------------------------------- /cali/lib/ppcenterderivative.m: -------------------------------------------------------------------------------- 1 | function [dp, p] = ppcenterderivative(cs) 2 | % partial derivative the weight center of a spline by the node position 3 | % [dp, p] = ppcenterderivative(cs); 4 | % where the cs is the return of sline.m, e.g. cs = spline(x,[0 y 0]); 5 | % the vectorized version of this function will be used in inverse geometry calibration 6 | 7 | dx = diff(cs.breaks); 8 | dx = dx(:); 9 | X = [dx.^5./5 dx.^4./4 dx.^3./3 dx.^2./2 dx]; 10 | 11 | wi = sum(cs.coefs.*X(:, 2:end), 2); 12 | ui = sum(cs.coefs.*X(:, 1:end-1), 2); 13 | 14 | w = sum(wi); 15 | c = cs.breaks(1:end-1)*wi + sum(ui); 16 | 17 | dwdx = -diff([0; wi./dx; 0]); 18 | dcdx = [wi; 0] - diff([0; wi.*cs.breaks(1:end-1)'./dx; 0]) - diff([0; ui./dx; 0]).*2; 19 | 20 | dp = (dcdx.*w - dwdx.*c)'./w^2; 21 | p = c/w; 22 | 23 | % w = sum(reshape(cs.coefs.*X(:, 2:end), [], 1)); 24 | % c = cs.breaks(1:end-1)*sum(cs.coefs.*X(:, 2:end),2) + sum(reshape(cs.coefs.*X(:, 1:end-1), [], 1)); 25 | % c = c/w; 26 | 27 | end -------------------------------------------------------------------------------- /cali/lib/ppweightcenter.m: -------------------------------------------------------------------------------- 1 | function c = ppweightcenter(cs) 2 | % to find the weight center of a spline 3 | % c = ppweightcenter(cs); 4 | % where the cs is the return of sline.m, e.g. cs = spline(x,[0 y 0]); 5 | 6 | dx = diff(cs.breaks); 7 | dx = dx(:); 8 | X = [dx.^5./5 dx.^4./4 dx.^3./3 dx.^2./2 dx]; 9 | 10 | w = sum(reshape(cs.coefs.*X(:, 2:end), [], 1)); 11 | c = cs.breaks(1:end-1)*sum(cs.coefs.*X(:, 2:end),2) + sum(reshape(cs.coefs.*X(:, 1:end-1), [], 1)); 12 | c = c/w; -------------------------------------------------------------------------------- /cali/offfocalloadkernel.m: -------------------------------------------------------------------------------- 1 | function offcorrprm = offfocalloadkernel(offfocalkernel, protocol) 2 | % find out the coupled offfocal kernel 3 | % a hard code based on an external offfocal-kernel defination xml file 4 | 5 | offcorrprm = struct(); 6 | if ~isempty(offfocalkernel) 7 | % cell to list 8 | offfocalkernel = structcellcurse(offfocalkernel); 9 | % check KV & bowtie 10 | isKV = [offfocalkernel.offfocalpara(:).KVp] == protocol.KV; 11 | isbowtie = strcmpi({offfocalkernel.offfocalpara(:).Bowtietype}, protocol.bowtie); 12 | % found any? 13 | index_cp = find(isKV & isbowtie, 1); 14 | if ~isempty(index_cp) 15 | % check collimator 16 | iscollimator = strcmp({offfocalkernel.offfocalpara(index_cp).collimation(:).collimationwidth}, ... 17 | protocol.collimator); 18 | index_colli = find(iscollimator, 1); 19 | if ~isempty(index_colli) 20 | % found 21 | offcorrprm = offfocalkernel.offfocalpara(index_cp).collimation(index_colli); 22 | end 23 | end 24 | end 25 | 26 | end -------------------------------------------------------------------------------- /doc/UserGuide.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CTsimulation 5 | 6 | 7 | 8 |

CTsimulation User Guide

9 |

  Dier Zhang

10 | CTsimulation is my open source codes for CT system simulation, calibration and reconstruction. 11 | 12 | 13 | 14 |

 1.  Quick Start

15 |

 2.  Configure the simulation

16 |

 3.  Configure the recon pipeline

17 | 18 | 19 |


20 | 21 |
22 | <prev 23 | top 24 | next> 25 |
26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/fig/addtool1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/doc/fig/addtool1.png -------------------------------------------------------------------------------- /geometry/fillupobject.m: -------------------------------------------------------------------------------- 1 | function object = fillupobject(object) 2 | % fillup an object 3 | 4 | if ~isstruct(object) 5 | return 6 | end 7 | 8 | if isfield(object, 'invV') 9 | object.invV = inv(object.vector); 10 | elseif isempty(object.invV) 11 | object.invV = inv(object.vector); 12 | end 13 | 14 | if isfield(object, 'volume') 15 | object.volume = defaultvolume(object.vector, object.type); 16 | elseif isempty(object.volume) 17 | object.volume = defaultvolume(object.vector, object.type); 18 | end 19 | 20 | return 21 | 22 | -------------------------------------------------------------------------------- /geometry/homotopy/square2circle.m: -------------------------------------------------------------------------------- 1 | function [u, v] = square2circle(x, y, flag_polar) 2 | % map points from |r|<=1 to |r|^2<=1 of 2-D. 3 | % function [u, v] = square2circle(x, y) 4 | 5 | if nargin<3 6 | flag_polar = false; 7 | end 8 | 9 | % rho 10 | rho = max(abs(x), abs(y)); 11 | % theta 12 | s1 = y>x; 13 | s2 = y>-x; 14 | xony = x./y; 15 | yonx = y./x; 16 | theta = fillmissing(yonx.*(~s1&s2), 'constant', 0); 17 | theta = theta + fillmissing((4+yonx).*(s1&~s2), 'constant', 0); 18 | theta = theta + fillmissing((2-xony).*(s1&s2), 'constant', 0); 19 | theta = theta + fillmissing((6-xony).*(~s1&~s2), 'constant', 0); 20 | theta = theta./8; 21 | 22 | if flag_polar 23 | u = rho; 24 | v = mod(theta, 1); 25 | else 26 | theta = theta.*(pi*2); 27 | u = rho.*cos(theta); 28 | v = rho.*sin(theta); 29 | end 30 | 31 | end -------------------------------------------------------------------------------- /geometry/intersection/multiinsect.m: -------------------------------------------------------------------------------- 1 | function D = multiinsect(L, R) 2 | 3 | D = min(R, [], 2) - max(L, [], 2); 4 | D(D<0) = 0; 5 | -------------------------------------------------------------------------------- /geometry/intersection/parallellinearinterp2D2.m: -------------------------------------------------------------------------------- 1 | function [interpX, interpY, cs_view] = parallellinearinterp2D2(Nx, Ny, d_h, viewangle, centerXY_h) 2 | 3 | if nargin<5 4 | centerXY_h = [0 0]; 5 | end 6 | if (viewangle>pi*2) 7 | error('Please mod the viewangle by 2*pi!'); 8 | end 9 | 10 | phase_flag = (viewangle>pi/4 & viewangle<=pi*3/4) | (viewangle>pi*5/4 & viewangle<=pi*7/4); 11 | % direct_flag = ~(viewangle>pi/4 & viewangle<=pi*5/4); 12 | 13 | if phase_flag 14 | dt = tan(pi/2-viewangle); 15 | cs_view = csc(viewangle); 16 | Nx_x = Nx; 17 | Ny_y = Ny; 18 | else 19 | dt = tan(viewangle); 20 | cs_view = -sec(viewangle); 21 | Nx_x = Ny; 22 | Ny_y = Nx; 23 | end 24 | 25 | Np = size(d_h, 1); 26 | d_h = d_h + centerXY_h*[-sin(viewangle); cos(viewangle)]; 27 | t = repmat((-(Ny_y-1)/2:(Ny_y-1)/2).*dt, Np, 1) - repmat(d_h.*cs_view, 1, Ny_y) + 1/2; 28 | if phase_flag 29 | interpX = t + Nx_x/2; 30 | interpY = repmat(1:Ny_y, Np, 1); 31 | else 32 | interpY = t + Ny_y/2; 33 | interpX = repmat(1:Nx_x, Np, 1); 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /geometry/intersection/parallellinearinterp3D.m: -------------------------------------------------------------------------------- 1 | function [interpX, interpY, interpZ, cs_view] = parallellinearinterp3D(imagesize, A, B, theta, center) 2 | 3 | if nargin<5 4 | center = [0 0 0]; 5 | end 6 | 7 | % rotation of A B 8 | Rtheta = [cos(theta) sin(theta) 0; -sin(theta) cos(theta) 0; 0 0 1]; 9 | A = A*Rtheta + center; 10 | B = B*Rtheta + center; 11 | % phase flag 12 | phase_flag = (theta>pi/4 & theta<=pi*3/4) | (theta>pi*5/4 & theta<=pi*7/4); 13 | if phase_flag 14 | cs_view = csc(theta); 15 | else 16 | cs_view = -sec(theta); 17 | end 18 | index_phs = phase_flag+1; 19 | 20 | % lines in image 3D 21 | V = B - A; 22 | Vmax = V(:, index_phs); 23 | AonV = A(:, index_phs)./Vmax; 24 | 25 | Dxyz = A - V.*AonV; 26 | Dxyz(:, index_phs) = 0; 27 | 28 | Vnr = V./Vmax; 29 | % Nmax = max(Nx, Ny); 30 | % gridmax = -(Nmax-1)/2 : (Nmax-1)/2; 31 | % t_n3 = Vnr(:)*gridmax + Dxyz(:); 32 | 33 | gridmax = -(max(imagesize)-1)/2 : (max(imagesize)-1)/2; 34 | interpX = Vnr(:, 1)*gridmax + Dxyz(:, 1) + (imagesize(1)+1)/2; 35 | interpY = Vnr(:, 2)*gridmax + Dxyz(:, 2) + (imagesize(2)+1)/2; 36 | interpZ = Vnr(:, 3)*gridmax + Dxyz(:, 3); 37 | 38 | end -------------------------------------------------------------------------------- /geometry/lib/ASGmodel.m: -------------------------------------------------------------------------------- 1 | function [Nt, alphaL, Dasg] = ASGmodel(normV, ASGdata) 2 | % ASG model 3 | % [Nt, alphaL, Dasg] = ASGmodel(normV, ASGdata); 4 | % where normV = normr(V); V is B-A , e.g. V = detposition - focalposition 5 | % 6 | 7 | nVdotndet = dot(normV, ASGdata.normvector, 2); 8 | 9 | t = [ASGdata.nAdotnXondet - dot(normV, ASGdata.nVedgex, 2)./nVdotndet ... 10 | ASGdata.nAdotnZondet - dot(normV, ASGdata.nVedgez, 2)./nVdotndet]; 11 | t = abs(t.*ASGdata.ASGheight - ASGdata.gap_n)./ASGdata.pixelspace; 12 | 13 | Nt = floor(t); 14 | alphaL = ((t-Nt).*ASGdata.pixelspace - ASGdata.gap_p)./(ASGdata.pixelspace - ASGdata.gap_p.*2); 15 | alphaL(alphaL<0) = 0; 16 | alphaL(alphaL>1) = 1; 17 | 18 | Dasg = ASGdata.ASGthickness./abs([dot(normV, ASGdata.nASGplx, 2) dot(normV, ASGdata.nASGplz, 2)]); 19 | 20 | end -------------------------------------------------------------------------------- /geometry/lib/defaultvolume.m: -------------------------------------------------------------------------------- 1 | function vol = defaultvolume(V, type) 2 | % retrun volume of an object 3 | % vol = defaultvolume(object.vector, object.type); 4 | 5 | switch lower(type) 6 | case {'cube', 'cuboid', 'parallelepiped', 'parallel hexahedron'} 7 | vol = det(V)*8; 8 | case {'sphere', 'ellipsoid'} 9 | vol = det(V)*(pi*3/4); 10 | case {'cylinder'} 11 | vol = det(V)*(pi*2); 12 | otherwise 13 | vol = 0; 14 | end 15 | 16 | return -------------------------------------------------------------------------------- /geometry/lib/objectrotation.m: -------------------------------------------------------------------------------- 1 | function object = objectrotation(object, A) 2 | % rotation by matrix A, A'*A=I. 3 | 4 | N = length(object(:)); 5 | for ii = 1:N 6 | object(ii).O = object(ii).O*A; 7 | object(ii).vector = object(ii).vector*A; 8 | if isfield(object(ii), 'invV') 9 | object(ii).invV = A'*object(ii).invV; 10 | end 11 | end -------------------------------------------------------------------------------- /geometry/lib/pararea.m: -------------------------------------------------------------------------------- 1 | function S = pararea(A, B) 2 | % retrun Area of parallelogram(s) 3 | 4 | S = sqrt((A(:,2).*B(:,3)-A(:,3).*B(:,2)).^2 + ... 5 | (A(:,3).*B(:,1)-A(:,1).*B(:,3)).^2 + ... 6 | (A(:,1).*B(:,2)-A(:,2).*B(:,1)).^2); 7 | return -------------------------------------------------------------------------------- /geometry/lib/pararea2.m: -------------------------------------------------------------------------------- 1 | function S2 = pararea2(A, B) 2 | % retrun Area^2 of parallelogram(s) 3 | 4 | S2 = (A(:,2,:).*B(:,3,:)-A(:,3,:).*B(:,2,:)).^2 + ... 5 | (A(:,3,:).*B(:,1,:)-A(:,1,:).*B(:,3,:)).^2 + ... 6 | (A(:,1,:).*B(:,2,:)-A(:,2,:).*B(:,1,:)).^2; 7 | end -------------------------------------------------------------------------------- /geometry/lib/polar2xyz.m: -------------------------------------------------------------------------------- 1 | function v = polar2xyz(u) 2 | % polar to xyz, u=[rho theta phi], v=[x y z]; 3 | 4 | v = [u(:,1).*cos(u(:,2)).*sin(u(:,3)) u(:,1).*sin(u(:,2)).*sin(u(:,3)) u(:,1).*cos(u(:,3))]; 5 | 6 | end -------------------------------------------------------------------------------- /geometry/lib/square2circle.m: -------------------------------------------------------------------------------- 1 | function [u, v] = square2circle(x, y, flag_polar) 2 | % map points from |r|<=1 to |r|^2<=1 of 2-D. 3 | % function [u, v] = square2circle(x, y) 4 | 5 | if nargin<3 6 | flag_polar = false; 7 | end 8 | 9 | % rho 10 | rho = max(abs(x), abs(y)); 11 | % theta 12 | s1 = y>x; 13 | s2 = y>-x; 14 | xony = x./y; 15 | yonx = y./x; 16 | theta = fillmissing(yonx.*(~s1&s2), 'constant', 0); 17 | theta = theta + fillmissing((4+yonx).*(s1&~s2), 'constant', 0); 18 | theta = theta + fillmissing((2-xony).*(s1&s2), 'constant', 0); 19 | theta = theta + fillmissing((6-xony).*(~s1&~s2), 'constant', 0); 20 | theta = theta./8; 21 | 22 | if flag_polar 23 | u = rho; 24 | v = mod(theta, 1); 25 | else 26 | theta = theta.*(pi*2); 27 | u = rho.*cos(theta); 28 | v = rho.*sin(theta); 29 | end 30 | 31 | end -------------------------------------------------------------------------------- /geometry/lib/xyz2polar.m: -------------------------------------------------------------------------------- 1 | function v = xyz2polar(u) 2 | % xyz to polar, u=[x y z], v=[rho theta phi]. 3 | 4 | v = u; 5 | % rho 6 | v(:,1) = sqrt(sum(u.^2, 2)); 7 | % theta 8 | v(:,2) = mod(atan2(u(:,2), u(:,1)), pi*2); 9 | % phi 10 | v(:,3) = fillmissing(acos(u(:,3)./v(:,1)), 'constant', 0); 11 | 12 | end -------------------------------------------------------------------------------- /geometry/objectvisual.m: -------------------------------------------------------------------------------- 1 | function [h, map] = objectvisual(object, hfig, color) 2 | % to plot(mesh) an object 3 | % [h, map] = objectvisual(object, hfig, color); 4 | % or h = objectvisual(object); 5 | % e.g. 6 | % f1=figure; hold on; 7 | % [h1, map1]=objectvisual(object1,f1,color1); CD1=h1.CData; 8 | % [h2, map2]=objectvisual(object2,f1,color2); CD2=h2.CData; 9 | % set(h1, 'CData', (CD1+1).*0.9999); set(h2, 'CData', (CD2+1).*0.9999+2); 10 | % colormap([map1; map2]); 11 | % caxis([0,4]); 12 | % to plot two objects in different color 13 | 14 | 15 | if nargin<2 16 | figure(); 17 | elseif isempty(hfig) 18 | figure(gcf); 19 | else 20 | figure(hfig); 21 | end 22 | if nargin<3 || isempty(color) 23 | color = hsv2rgb(rand(1, 3).*0.8 + 0.2); 24 | end 25 | 26 | % object meshgrid 27 | [X, Y, Z, C] = objectmeshgrid(object); 28 | 29 | cscale = linspace(0.6, 1.3, 64); 30 | map = 1-cscale(:)*(1-color); 31 | map(map>1) = 1; 32 | map(map<0) = 0; 33 | 34 | colormap(map); 35 | h = mesh(X, Y, Z, C, 'FaceAlpha', 0.3); 36 | 37 | end 38 | 39 | -------------------------------------------------------------------------------- /geometry/ppcenterderivative.m: -------------------------------------------------------------------------------- 1 | function [dp, p] = ppcenterderivative(cs) 2 | % partial derivative the weight center of a spline by the node position 3 | % [dp, p] = ppcenterderivative(cs); 4 | % where the cs is the return of sline.m, e.g. cs = spline(x,[0 y 0]); 5 | % the vectorized version of this function will be used in inverse geometry calibration 6 | 7 | dx = diff(cs.breaks); 8 | dx = dx(:); 9 | X = [dx.^5./5 dx.^4./4 dx.^3./3 dx.^2./2 dx]; 10 | 11 | wi = sum(cs.coefs.*X(:, 2:end), 2); 12 | ui = sum(cs.coefs.*X(:, 1:end-1), 2); 13 | 14 | w = sum(wi); 15 | c = cs.breaks(1:end-1)*wi + sum(ui); 16 | 17 | dwdx = -diff([0; wi./dx; 0]); 18 | dcdx = [wi; 0] - diff([0; wi.*cs.breaks(1:end-1)'./dx; 0]) - diff([0; ui./dx; 0]).*2; 19 | 20 | dp = (dcdx.*w - dwdx.*c)'./w^2; 21 | p = c/w; 22 | 23 | % w = sum(reshape(cs.coefs.*X(:, 2:end), [], 1)); 24 | % c = cs.breaks(1:end-1)*sum(cs.coefs.*X(:, 2:end),2) + sum(reshape(cs.coefs.*X(:, 1:end-1), [], 1)); 25 | % c = c/w; 26 | 27 | end -------------------------------------------------------------------------------- /geometry/ppweightcenter.m: -------------------------------------------------------------------------------- 1 | function c = ppweightcenter(cs) 2 | % to find the weight center of a spline 3 | % c = ppweightcenter(cs); 4 | % where the cs is the return of sline.m, e.g. cs = spline(x,[0 y 0]); 5 | 6 | dx = diff(cs.breaks); 7 | dx = dx(:); 8 | X = [dx.^5./5 dx.^4./4 dx.^3./3 dx.^2./2 dx]; 9 | 10 | w = sum(reshape(cs.coefs.*X(:, 2:end), [], 1)); 11 | c = cs.breaks(1:end-1)*sum(cs.coefs.*X(:, 2:end),2) + sum(reshape(cs.coefs.*X(:, 1:end-1), [], 1)); 12 | c = c/w; -------------------------------------------------------------------------------- /physics/effectZandMass.m: -------------------------------------------------------------------------------- 1 | function [Zeff, Weff] = effectZandMass(material) 2 | % effective 'atomic' Z and mass of a molecular 3 | % [Zeff, Weff] = effectZandMass(material). 4 | % The Z of a molecular is the sum of its elements, and the mass of it is also the sum of its elements. 5 | % This molecular can be nearly equal to N effective atoms with effective Z=Zeff and effective mass=Weff. 6 | 7 | % the molecular is a 'big atom' in Z=sumZ, mass=sumW 8 | sumZ = [material.elemprm(:).Z]*material.elemmol; 9 | sumW = [material.elemprm(:).weight]*material.elemmol; 10 | 11 | % meanly devide the 'big atom' to small effective atoms in this way, 12 | Zeff = (([material.elemprm(:).Z].^4*material.elemmol) / sumZ).^(1/3); 13 | Weff = sumW/sumZ * Zeff; 14 | 15 | end -------------------------------------------------------------------------------- /physics/loadmaterial.m: -------------------------------------------------------------------------------- 1 | function material_cfg = loadmaterial(material_file) 2 | % load material configure file 3 | % material_cfg = loadmaterial(material_file) or loadmaterial(material_name) 4 | 5 | if exist(material_file, 'file') 6 | material_cfg = jsonread(material_file); 7 | elseif exist([material_file, '.cfg'], 'file') 8 | material_cfg = jsonread([material_file, '.cfg']); 9 | else 10 | error(['Can not find .cfg file for material: ', material_file]); 11 | end 12 | -------------------------------------------------------------------------------- /physics/matter/elements/Ac.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ac", 3 | "Z": 89, 4 | "weight": 227.0278, 5 | "density": 10.05, 6 | "edges": 24, 7 | "E_edges": [ 8 | 106.755, 9 | 19.84, 10 | 19.0832, 11 | 15.871, 12 | 5.002, 13 | 4.656, 14 | 3.909, 15 | 3.3702, 16 | 3.219, 17 | 1.269, 18 | 1.08, 19 | 0.89, 20 | 0.6749, 21 | 0.637, 22 | 0.303944, 23 | 0.295067, 24 | 0.261255, 25 | 0.206171, 26 | 0.163235, 27 | 0.0831361, 28 | 0.0769389, 29 | 0.0404636, 30 | 0.0251851, 31 | 0.0184021 32 | ], 33 | "f_relH82": -2.3597, 34 | "f_rel35CL": -1.3722, 35 | "f_NT": -0.01914 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ag.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ag", 3 | "Z": 47, 4 | "weight": 107.8682, 5 | "density": 10.48, 6 | "edges": 14, 7 | "E_edges": [ 8 | 25.514, 9 | 3.8058, 10 | 3.5237, 11 | 3.3511, 12 | 0.7175, 13 | 0.6024, 14 | 0.5714, 15 | 0.3728, 16 | 0.3667, 17 | 0.0952, 18 | 0.0626, 19 | 0.0559, 20 | 0.0033, 21 | 0.0033 22 | ], 23 | "f_relH82": -0.4549, 24 | "f_rel35CL": -0.2826, 25 | "f_NT": -0.011234 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Al.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Al", 3 | "Z": 13, 4 | "weight": 26.9815, 5 | "density": 2.6941, 6 | "edges": 5, 7 | "E_edges": [ 8 | 1.5596, 9 | 0.1177, 10 | 0.0731, 11 | 0.0731, 12 | 0.00837567 13 | ], 14 | "f_relH82": -0.022218, 15 | "f_rel35CL": -0.0126, 16 | "f_NT": -0.0034361 17 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ar.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ar", 3 | "Z": 18, 4 | "weight": 39.948, 5 | "density": 0.00166, 6 | "edges": 7, 7 | "E_edges": [ 8 | 3.2029, 9 | 0.32, 10 | 0.2473, 11 | 0.2452, 12 | 0.0253, 13 | 0.0124, 14 | 0.0124 15 | ], 16 | "f_relH82": -0.046144, 17 | "f_rel35CL": -0.0282, 18 | "f_NT": -0.0044493 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/As.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "As", 3 | "Z": 33, 4 | "weight": 74.9216, 5 | "density": 5.72, 6 | "edges": 9, 7 | "E_edges": [ 8 | 11.8667, 9 | 1.5265, 10 | 1.3586, 11 | 1.3231, 12 | 0.2035, 13 | 0.1464, 14 | 0.1405, 15 | 0.0412, 16 | 0.0412 17 | ], 18 | "f_relH82": -0.19087, 19 | "f_rel35CL": -0.12, 20 | "f_NT": -0.0079737 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/At.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "At", 3 | "Z": 85, 4 | "weight": 210.0, 5 | "density": 1.0, 6 | "edges": 24, 7 | "E_edges": [ 8 | 95.7299, 9 | 17.493, 10 | 16.7847, 11 | 14.2135, 12 | 4.317, 13 | 4.008, 14 | 3.426, 15 | 2.9087, 16 | 2.7867, 17 | 1.042, 18 | 0.886, 19 | 0.74, 20 | 0.5332, 21 | 0.475385, 22 | 0.197076, 23 | 0.190577, 24 | 0.185617, 25 | 0.138499, 26 | 0.108426, 27 | 0.0415942, 28 | 0.0376618, 29 | 0.019339, 30 | 0.00903104, 31 | 0.0062445 32 | ], 33 | "f_relH82": -2.0891, 34 | "f_rel35CL": -1.2198, 35 | "f_NT": -0.018874 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Au.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Au", 3 | "Z": 79, 4 | "weight": 196.9665, 5 | "density": 18.85, 6 | "edges": 21, 7 | "E_edges": [ 8 | 80.7249, 9 | 14.3528, 10 | 13.7336, 11 | 11.9187, 12 | 3.4249, 13 | 3.1478, 14 | 2.743, 15 | 2.2911, 16 | 2.2057, 17 | 0.7588, 18 | 0.6437, 19 | 0.5454, 20 | 0.352, 21 | 0.3339, 22 | 0.0864, 23 | 0.0828, 24 | 0.1078, 25 | 0.0717, 26 | 0.0537, 27 | 0.00830838, 28 | 0.00679032 29 | ], 30 | "f_relH82": -1.7226, 31 | "f_rel35CL": -1.0134, 32 | "f_NT": -0.017382 33 | } -------------------------------------------------------------------------------- /physics/matter/elements/B.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "B", 3 | "Z": 5, 4 | "weight": 10.81, 5 | "density": 2.34, 6 | "edges": 3, 7 | "E_edges": [ 8 | 0.188, 9 | 0.01347, 10 | 0.0047 11 | ], 12 | "f_relH82": -0.0028487, 13 | "f_rel35CL": -0.0012, 14 | "f_NT": -0.0012687 15 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ba.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ba", 3 | "Z": 56, 4 | "weight": 137.33, 5 | "density": 3.5, 6 | "edges": 17, 7 | "E_edges": [ 8 | 37.4406, 9 | 5.9888, 10 | 5.6236, 11 | 5.247, 12 | 1.2928, 13 | 1.1367, 14 | 1.0622, 15 | 0.7961, 16 | 0.7807, 17 | 0.253, 18 | 0.1918, 19 | 0.1797, 20 | 0.0925, 21 | 0.0899, 22 | 0.0391, 23 | 0.0166, 24 | 0.0146 25 | ], 26 | "f_relH82": -0.70761, 27 | "f_rel35CL": -0.4326, 28 | "f_NT": -0.012527 29 | } -------------------------------------------------------------------------------- /physics/matter/elements/Be.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Be", 3 | "Z": 4, 4 | "weight": 9.01218, 5 | "density": 1.845, 6 | "edges": 2, 7 | "E_edges": [ 8 | 0.111, 9 | 0.00842 10 | ], 11 | "f_relH82": -0.0017882, 12 | "f_rel35CL": -0.0006, 13 | "f_NT": -0.00097394 14 | } -------------------------------------------------------------------------------- /physics/matter/elements/Bi.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Bi", 3 | "Z": 83, 4 | "weight": 208.9804, 5 | "density": 9.73, 6 | "edges": 23, 7 | "E_edges": [ 8 | 90.5259, 9 | 16.3875, 10 | 15.7111, 11 | 13.4186, 12 | 3.9991, 13 | 3.6963, 14 | 3.1769, 15 | 2.6876, 16 | 2.5796, 17 | 0.9382, 18 | 0.8053, 19 | 0.6789, 20 | 0.4636, 21 | 0.44, 22 | 0.1619, 23 | 0.1574, 24 | 0.1593, 25 | 0.1168, 26 | 0.0928, 27 | 0.0265, 28 | 0.0244, 29 | 0.0142334, 30 | 0.00616991 31 | ], 32 | "f_relH82": -1.9618, 33 | "f_rel35CL": -1.1484, 34 | "f_NT": -0.018084 35 | } -------------------------------------------------------------------------------- /physics/matter/elements/Br.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Br", 3 | "Z": 35, 4 | "weight": 79.904, 5 | "density": 3.11, 6 | "edges": 9, 7 | "E_edges": [ 8 | 13.4737, 9 | 1.782, 10 | 1.596, 11 | 1.5499, 12 | 0.2565, 13 | 0.1893, 14 | 0.1815, 15 | 0.0701, 16 | 0.069 17 | ], 18 | "f_relH82": -0.22007, 19 | "f_rel35CL": -0.1386, 20 | "f_NT": -0.0084102 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/C.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C", 3 | "Z": 6, 4 | "weight": 12.011, 5 | "density": 2.26, 6 | "edges": 3, 7 | "E_edges": [ 8 | 0.2838, 9 | 0.01951, 10 | 0.0064 11 | ], 12 | "f_relH82": -0.004181, 13 | "f_rel35CL": -0.0018, 14 | "f_NT": -0.0016442 15 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ca.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ca", 3 | "Z": 20, 4 | "weight": 40.08, 5 | "density": 1.55, 6 | "edges": 7, 7 | "E_edges": [ 8 | 4.0381, 9 | 0.4378, 10 | 0.35, 11 | 0.3464, 12 | 0.0437, 13 | 0.0254, 14 | 0.0254 15 | ], 16 | "f_relH82": -0.05872, 17 | "f_rel35CL": -0.036, 18 | "f_NT": -0.0054748 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Cd.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cd", 3 | "Z": 48, 4 | "weight": 112.41, 5 | "density": 8.63, 6 | "edges": 14, 7 | "E_edges": [ 8 | 26.7112, 9 | 4.018, 10 | 3.727, 11 | 3.5375, 12 | 0.7702, 13 | 0.6507, 14 | 0.6165, 15 | 0.4105, 16 | 0.4037, 17 | 0.1076, 18 | 0.0669, 19 | 0.0669, 20 | 0.0093, 21 | 0.0093 22 | ], 23 | "f_relH82": -0.47951, 24 | "f_rel35CL": -0.2976, 25 | "f_NT": -0.011244 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ce.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ce", 3 | "Z": 58, 4 | "weight": 140.12, 5 | "density": 6.637, 6 | "edges": 18, 7 | "E_edges": [ 8 | 40.443, 9 | 6.5488, 10 | 6.1642, 11 | 5.7234, 12 | 1.4346, 13 | 1.2728, 14 | 1.1854, 15 | 0.9013, 16 | 0.8833, 17 | 0.2896, 18 | 0.2233, 19 | 0.2072, 20 | 0.11, 21 | 0.11, 22 | 0.0859, 23 | 0.0378, 24 | 0.0198, 25 | 0.0198 26 | ], 27 | "f_relH82": -0.77379, 28 | "f_rel35CL": -0.4716, 29 | "f_NT": -0.01317 30 | } -------------------------------------------------------------------------------- /physics/matter/elements/Cl.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cl", 3 | "Z": 17, 4 | "weight": 35.453, 5 | "density": 1.56, 6 | "edges": 7, 7 | "E_edges": [ 8 | 2.8224, 9 | 0.2702, 10 | 0.2016, 11 | 0.2, 12 | 0.0175, 13 | 0.0068, 14 | 0.0068 15 | ], 16 | "f_relH82": -0.040526, 17 | "f_rel35CL": -0.0246, 18 | "f_NT": -0.0044718 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Co.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Co", 3 | "Z": 27, 4 | "weight": 58.9332, 5 | "density": 8.9, 6 | "edges": 9, 7 | "E_edges": [ 8 | 7.7089, 9 | 0.9256, 10 | 0.7936, 11 | 0.7786, 12 | 0.1007, 13 | 0.0595, 14 | 0.0595, 15 | 0.0029, 16 | 0.0029 17 | ], 18 | "f_relH82": -0.11819, 19 | "f_rel35CL": -0.0738, 20 | "f_NT": -0.0067859 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Cr.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cr", 3 | "Z": 24, 4 | "weight": 51.996, 5 | "density": 7.18, 6 | "edges": 9, 7 | "E_edges": [ 8 | 5.9892, 9 | 0.6946, 10 | 0.5837, 11 | 0.5745, 12 | 0.0741, 13 | 0.0425, 14 | 0.0425, 15 | 0.0023, 16 | 0.0023 17 | ], 18 | "f_relH82": -0.089603, 19 | "f_rel35CL": -0.0558, 20 | "f_NT": -0.006077 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Cs.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cs", 3 | "Z": 55, 4 | "weight": 132.9054, 5 | "density": 1.87, 6 | "edges": 17, 7 | "E_edges": [ 8 | 35.9846, 9 | 5.7143, 10 | 5.3594, 11 | 5.0119, 12 | 1.2171, 13 | 1.065, 14 | 0.9976, 15 | 0.7395, 16 | 0.7255, 17 | 0.2308, 18 | 0.1723, 19 | 0.1616, 20 | 0.0788, 21 | 0.0765, 22 | 0.0227, 23 | 0.0131, 24 | 0.0114 25 | ], 26 | "f_relH82": -0.67594, 27 | "f_rel35CL": -0.414, 28 | "f_NT": -0.012486 29 | } -------------------------------------------------------------------------------- /physics/matter/elements/Cu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cu", 3 | "Z": 29, 4 | "weight": 63.546, 5 | "density": 8.94, 6 | "edges": 9, 7 | "E_edges": [ 8 | 8.9789, 9 | 1.0961, 10 | 0.951, 11 | 0.9311, 12 | 0.1198, 13 | 0.0736, 14 | 0.0736, 15 | 0.0016, 16 | 0.0016 17 | ], 18 | "f_relH82": -0.14003, 19 | "f_rel35CL": -0.0876, 20 | "f_NT": -0.0072602 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Dy.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Dy", 3 | "Z": 66, 4 | "weight": 162.5, 5 | "density": 8.525, 6 | "edges": 19, 7 | "E_edges": [ 8 | 53.7885, 9 | 9.0458, 10 | 8.5806, 11 | 7.7901, 12 | 2.0468, 13 | 1.8418, 14 | 1.6756, 15 | 1.3325, 16 | 1.2949, 17 | 0.4163, 18 | 0.3318, 19 | 0.2929, 20 | 0.1542, 21 | 0.1542, 22 | 0.0042, 23 | 0.0042, 24 | 0.0629, 25 | 0.0263, 26 | 0.0263 27 | ], 28 | "f_relH82": -1.0783, 29 | "f_rel35CL": -0.6474, 30 | "f_NT": -0.014705 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/Er.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Er", 3 | "Z": 68, 4 | "weight": 167.26, 5 | "density": 9.039, 6 | "edges": 19, 7 | "E_edges": [ 8 | 57.4855, 9 | 9.7513, 10 | 9.2643, 11 | 8.3579, 12 | 2.2065, 13 | 2.0058, 14 | 1.8118, 15 | 1.4533, 16 | 1.4093, 17 | 0.4491, 18 | 0.3662, 19 | 0.32, 20 | 0.1767, 21 | 0.1676, 22 | 0.0043, 23 | 0.0043, 24 | 0.0598, 25 | 0.0294, 26 | 0.0294 27 | ], 28 | "f_relH82": -1.1649, 29 | "f_rel35CL": -0.6966, 30 | "f_NT": -0.015166 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/Eu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Eu", 3 | "Z": 63, 4 | "weight": 151.96, 5 | "density": 5.228, 6 | "edges": 18, 7 | "E_edges": [ 8 | 48.519, 9 | 8.052, 10 | 7.6171, 11 | 6.9769, 12 | 1.8, 13 | 1.6139, 14 | 1.4806, 15 | 1.1606, 16 | 1.1309, 17 | 0.3602, 18 | 0.2839, 19 | 0.2566, 20 | 0.1332, 21 | 0.1332, 22 | 0.00291151, 23 | 0.0318, 24 | 0.022, 25 | 0.022 26 | ], 27 | "f_relH82": -0.95641, 28 | "f_rel35CL": -0.5772, 29 | "f_NT": -0.014328 30 | } -------------------------------------------------------------------------------- /physics/matter/elements/F.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "F", 3 | "Z": 9, 4 | "weight": 18.9984, 5 | "density": 1.108, 6 | "edges": 4, 7 | "E_edges": [ 8 | 0.6854, 9 | 0.031, 10 | 0.0086, 11 | 0.0086 12 | ], 13 | "f_relH82": -0.0099395, 14 | "f_rel35CL": -0.0054, 15 | "f_NT": -0.0023389 16 | } -------------------------------------------------------------------------------- /physics/matter/elements/Fe.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Fe", 3 | "Z": 26, 4 | "weight": 55.847, 5 | "density": 7.86, 6 | "edges": 9, 7 | "E_edges": [ 8 | 7.112, 9 | 0.8461, 10 | 0.7211, 11 | 0.7081, 12 | 0.0929, 13 | 0.054, 14 | 0.054, 15 | 0.0036, 16 | 0.0036 17 | ], 18 | "f_relH82": -0.10812, 19 | "f_rel35CL": -0.0678, 20 | "f_NT": -0.0066403 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Fr.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Fr", 3 | "Z": 87, 4 | "weight": 223.0, 5 | "density": 1.0, 6 | "edges": 24, 7 | "E_edges": [ 8 | 101.137, 9 | 18.639, 10 | 17.9065, 11 | 15.0312, 12 | 4.652, 13 | 4.327, 14 | 3.663, 15 | 3.1362, 16 | 2.9997, 17 | 1.153, 18 | 0.98, 19 | 0.81, 20 | 0.6033, 21 | 0.577, 22 | 0.246488, 23 | 0.238863, 24 | 0.220035, 25 | 0.169009, 26 | 0.132957, 27 | 0.0595378, 28 | 0.0545529, 29 | 0.0278679, 30 | 0.015165, 31 | 0.0106123 32 | ], 33 | "f_relH82": -2.2217, 34 | "f_rel35CL": -1.2942, 35 | "f_NT": -0.01862 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ga.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ga", 3 | "Z": 31, 4 | "weight": 69.72, 5 | "density": 5.877, 6 | "edges": 9, 7 | "E_edges": [ 8 | 10.3671, 9 | 1.2977, 10 | 1.1423, 11 | 1.1154, 12 | 0.1581, 13 | 0.1068, 14 | 0.1029, 15 | 0.0174, 16 | 0.0174 17 | ], 18 | "f_relH82": -0.16423, 19 | "f_rel35CL": -0.1032, 20 | "f_NT": -0.0075615 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Gd.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gd", 3 | "Z": 64, 4 | "weight": 157.25, 5 | "density": 7.877, 6 | "edges": 19, 7 | "E_edges": [ 8 | 50.2391, 9 | 8.3756, 10 | 7.9303, 11 | 7.2428, 12 | 1.8808, 13 | 1.6883, 14 | 1.544, 15 | 1.2172, 16 | 1.1852, 17 | 0.3758, 18 | 0.2885, 19 | 0.2709, 20 | 0.1405, 21 | 0.1405, 22 | 0.0092794, 23 | 0.00852419, 24 | 0.0361, 25 | 0.0203, 26 | 0.0203 27 | ], 28 | "f_relH82": -0.99598, 29 | "f_rel35CL": -0.6, 30 | "f_NT": -0.014289 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ge.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ge", 3 | "Z": 32, 4 | "weight": 72.59, 5 | "density": 5.307, 6 | "edges": 9, 7 | "E_edges": [ 8 | 11.1031, 9 | 1.4143, 10 | 1.2478, 11 | 1.2167, 12 | 0.18, 13 | 0.1279, 14 | 0.1208, 15 | 0.0287, 16 | 0.0287 17 | ], 18 | "f_relH82": -0.17723, 19 | "f_rel35CL": -0.1116, 20 | "f_NT": -0.0077386 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/H.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "H", 3 | "Z": 1, 4 | "weight": 1.008, 5 | "density": 8.987e-05, 6 | "edges": 0, 7 | "E_edges": [], 8 | "f_relH82": -0.00010519, 9 | "f_rel35CL": 0.0, 10 | "f_NT": -0.00054423 11 | } -------------------------------------------------------------------------------- /physics/matter/elements/He.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "He", 3 | "Z": 2, 4 | "weight": 4.003, 5 | "density": 0.0001664, 6 | "edges": 0, 7 | "E_edges": [], 8 | "f_relH82": -0.00042952, 9 | "f_rel35CL": 0.0, 10 | "f_NT": -0.00054817 11 | } -------------------------------------------------------------------------------- /physics/matter/elements/Hf.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Hf", 3 | "Z": 72, 4 | "weight": 178.49, 5 | "density": 13.29, 6 | "edges": 20, 7 | "E_edges": [ 8 | 65.3508, 9 | 11.2707, 10 | 10.7394, 11 | 9.5607, 12 | 2.6009, 13 | 2.3654, 14 | 2.1076, 15 | 1.7164, 16 | 1.6617, 17 | 0.5381, 18 | 0.437, 19 | 0.3804, 20 | 0.2238, 21 | 0.2137, 22 | 0.0171, 23 | 0.0171, 24 | 0.0649, 25 | 0.0381, 26 | 0.0306, 27 | 0.005 28 | ], 29 | "f_relH82": -1.3514, 30 | "f_rel35CL": -0.8028, 31 | "f_NT": -0.015933 32 | } -------------------------------------------------------------------------------- /physics/matter/elements/Hg.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Hg", 3 | "Z": 80, 4 | "weight": 200.59, 5 | "density": 13.522, 6 | "edges": 22, 7 | "E_edges": [ 8 | 83.1023, 9 | 14.8393, 10 | 14.2087, 11 | 12.2839, 12 | 3.5616, 13 | 3.2785, 14 | 2.8471, 15 | 2.3849, 16 | 2.2949, 17 | 0.8003, 18 | 0.6769, 19 | 0.571, 20 | 0.3783, 21 | 0.3598, 22 | 0.1022, 23 | 0.0985, 24 | 0.1203, 25 | 0.0805, 26 | 0.0576, 27 | 0.0064, 28 | 0.0064, 29 | 0.00771361 30 | ], 31 | "f_relH82": -1.7805, 32 | "f_rel35CL": -1.0458, 33 | "f_NT": -0.017503 34 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ho.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ho", 3 | "Z": 67, 4 | "weight": 164.9304, 5 | "density": 8.769, 6 | "edges": 19, 7 | "E_edges": [ 8 | 55.6177, 9 | 9.3942, 10 | 8.9178, 11 | 8.0711, 12 | 2.1283, 13 | 1.9228, 14 | 1.7412, 15 | 1.3915, 16 | 1.3514, 17 | 0.4357, 18 | 0.3435, 19 | 0.3066, 20 | 0.161, 21 | 0.161, 22 | 0.0037, 23 | 0.0037, 24 | 0.0512, 25 | 0.0203, 26 | 0.0203 27 | ], 28 | "f_relH82": -1.121, 29 | "f_rel35CL": -0.6714, 30 | "f_NT": -0.014931 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/I.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "I", 3 | "Z": 53, 4 | "weight": 126.9045, 5 | "density": 4.92, 6 | "edges": 14, 7 | "E_edges": [ 8 | 33.1694, 9 | 5.1881, 10 | 4.8521, 11 | 4.5571, 12 | 1.0721, 13 | 0.9305, 14 | 0.8746, 15 | 0.6313, 16 | 0.6194, 17 | 0.1864, 18 | 0.1227, 19 | 0.1227, 20 | 0.0496, 21 | 0.0496 22 | ], 23 | "f_relH82": -0.61537, 24 | "f_rel35CL": -0.3786, 25 | "f_NT": -0.012143 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/In.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "In", 3 | "Z": 49, 4 | "weight": 114.82, 5 | "density": 7.3, 6 | "edges": 14, 7 | "E_edges": [ 8 | 27.9399, 9 | 4.2375, 10 | 3.938, 11 | 3.7301, 12 | 0.8256, 13 | 0.7022, 14 | 0.6643, 15 | 0.4508, 16 | 0.4431, 17 | 0.1219, 18 | 0.0774, 19 | 0.0774, 20 | 0.0162, 21 | 0.0162 22 | ], 23 | "f_relH82": -0.50495, 24 | "f_rel35CL": -0.3126, 25 | "f_NT": -0.011471 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ir.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ir", 3 | "Z": 77, 4 | "weight": 192.22, 5 | "density": 22.39, 6 | "edges": 21, 7 | "E_edges": [ 8 | 76.111, 9 | 13.4185, 10 | 12.8241, 11 | 11.2152, 12 | 3.1737, 13 | 2.9087, 14 | 2.5507, 15 | 2.1161, 16 | 2.0404, 17 | 0.6901, 18 | 0.5771, 19 | 0.4943, 20 | 0.3114, 21 | 0.2949, 22 | 0.0634, 23 | 0.0605, 24 | 0.0952, 25 | 0.063, 26 | 0.0505, 27 | 0.00806275, 28 | 0.00685456 29 | ], 30 | "f_relH82": -1.6105, 31 | "f_rel35CL": -0.9498, 32 | "f_NT": -0.016921 33 | } -------------------------------------------------------------------------------- /physics/matter/elements/K.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "K", 3 | "Z": 19, 4 | "weight": 39.0983, 5 | "density": 0.86, 6 | "edges": 7, 7 | "E_edges": [ 8 | 3.6074, 9 | 0.3771, 10 | 0.2963, 11 | 0.2936, 12 | 0.0339, 13 | 0.0178, 14 | 0.0178 15 | ], 16 | "f_relH82": -0.052204, 17 | "f_rel35CL": -0.0318, 18 | "f_NT": -0.0050651 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Kr.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Kr", 3 | "Z": 36, 4 | "weight": 83.8, 5 | "density": 0.003484, 6 | "edges": 9, 7 | "E_edges": [ 8 | 14.3256, 9 | 1.921, 10 | 1.7272, 11 | 1.6749, 12 | 0.28833, 13 | 0.2227, 14 | 0.2138, 15 | 0.0889, 16 | 0.0889 17 | ], 18 | "f_relH82": -0.23566, 19 | "f_rel35CL": -0.1482, 20 | "f_NT": -0.008484 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/La.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "La", 3 | "Z": 57, 4 | "weight": 138.9055, 5 | "density": 6.127, 6 | "edges": 17, 7 | "E_edges": [ 8 | 38.9246, 9 | 6.2663, 10 | 5.8906, 11 | 5.4827, 12 | 1.3613, 13 | 1.2044, 14 | 1.1234, 15 | 0.8485, 16 | 0.8317, 17 | 0.2704, 18 | 0.2058, 19 | 0.1914, 20 | 0.0989, 21 | 0.0989, 22 | 0.0323, 23 | 0.0144, 24 | 0.0144 25 | ], 26 | "f_relH82": -0.74022, 27 | "f_rel35CL": -0.4518, 28 | "f_NT": -0.012831 29 | } -------------------------------------------------------------------------------- /physics/matter/elements/Li.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Li", 3 | "Z": 3, 4 | "weight": 6.941, 5 | "density": 0.533, 6 | "edges": 2, 7 | "E_edges": [ 8 | 0.05475, 9 | 0.00534 10 | ], 11 | "f_relH82": -0.00098613, 12 | "f_rel35CL": -0.0006, 13 | "f_NT": -0.00071131 14 | } -------------------------------------------------------------------------------- /physics/matter/elements/Lu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Lu", 3 | "Z": 71, 4 | "weight": 174.967, 5 | "density": 9.811, 6 | "edges": 19, 7 | "E_edges": [ 8 | 63.3138, 9 | 10.8704, 10 | 10.3486, 11 | 9.2441, 12 | 2.4912, 13 | 2.2635, 14 | 2.0236, 15 | 1.6394, 16 | 1.5885, 17 | 0.5062, 18 | 0.4101, 19 | 0.3593, 20 | 0.2048, 21 | 0.195, 22 | 0.0069, 23 | 0.0069, 24 | 0.0568, 25 | 0.028, 26 | 0.028 27 | ], 28 | "f_relH82": -1.303, 29 | "f_rel35CL": -0.7758, 30 | "f_NT": -0.015805 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/Mg.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mg", 3 | "Z": 12, 4 | "weight": 24.305, 5 | "density": 1.735, 6 | "edges": 4, 7 | "E_edges": [ 8 | 1.305, 9 | 0.0894, 10 | 0.0514, 11 | 0.0514 12 | ], 13 | "f_relH82": -0.018616, 14 | "f_rel35CL": -0.0108, 15 | "f_NT": -0.0032502 16 | } -------------------------------------------------------------------------------- /physics/matter/elements/Mn.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mn", 3 | "Z": 25, 4 | "weight": 54.938, 5 | "density": 7.43, 6 | "edges": 9, 7 | "E_edges": [ 8 | 6.539, 9 | 0.769, 10 | 0.6514, 11 | 0.6403, 12 | 0.0839, 13 | 0.0486, 14 | 0.0486, 15 | 0.00726159, 16 | 0.00714378 17 | ], 18 | "f_relH82": -0.098594, 19 | "f_rel35CL": -0.0612, 20 | "f_NT": -0.0062409 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Mo.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mo", 3 | "Z": 42, 4 | "weight": 95.94, 5 | "density": 10.2, 6 | "edges": 14, 7 | "E_edges": [ 8 | 19.9995, 9 | 2.8655, 10 | 2.6251, 11 | 2.5202, 12 | 0.5046, 13 | 0.4097, 14 | 0.3923, 15 | 0.2303, 16 | 0.227, 17 | 0.0618, 18 | 0.0348, 19 | 0.0348, 20 | 0.0018, 21 | 0.0018 22 | ], 23 | "f_relH82": -0.34394, 24 | "f_rel35CL": -0.2154, 25 | "f_NT": -0.010086 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/N.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "N", 3 | "Z": 7, 4 | "weight": 14.0067, 5 | "density": 0.001165, 6 | "edges": 4, 7 | "E_edges": [ 8 | 0.4016, 9 | 0.02631, 10 | 0.0092, 11 | 0.0092 12 | ], 13 | "f_relH82": -0.0057982, 14 | "f_rel35CL": -0.003, 15 | "f_NT": -0.0019191 16 | } -------------------------------------------------------------------------------- /physics/matter/elements/Na.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Na", 3 | "Z": 11, 4 | "weight": 22.9898, 5 | "density": 0.969, 6 | "edges": 4, 7 | "E_edges": [ 8 | 1.0721, 9 | 0.0633, 10 | 0.0311, 11 | 0.0311 12 | ], 13 | "f_relH82": -0.015378, 14 | "f_rel35CL": -0.0084, 15 | "f_NT": -0.0028873 16 | } -------------------------------------------------------------------------------- /physics/matter/elements/Nb.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Nb", 3 | "Z": 41, 4 | "weight": 92.9064, 5 | "density": 8.55, 6 | "edges": 13, 7 | "E_edges": [ 8 | 18.9856, 9 | 2.6977, 10 | 2.4647, 11 | 2.3705, 12 | 0.4684, 13 | 0.3784, 14 | 0.363, 15 | 0.2074, 16 | 0.2046, 17 | 0.0581, 18 | 0.0339, 19 | 0.0339, 20 | 0.0032 21 | ], 22 | "f_relH82": -0.32408, 23 | "f_rel35CL": -0.2028, 24 | "f_NT": -0.0099257 25 | } -------------------------------------------------------------------------------- /physics/matter/elements/Nd.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Nd", 3 | "Z": 60, 4 | "weight": 144.24, 5 | "density": 6.994, 6 | "edges": 18, 7 | "E_edges": [ 8 | 43.5689, 9 | 7.126, 10 | 6.7215, 11 | 6.2079, 12 | 1.5753, 13 | 1.4028, 14 | 1.2974, 15 | 0.9995, 16 | 0.9777, 17 | 0.3152, 18 | 0.2433, 19 | 0.2246, 20 | 0.1175, 21 | 0.1175, 22 | 0.003, 23 | 0.0375, 24 | 0.0211, 25 | 0.0211 26 | ], 27 | "f_relH82": -0.84384, 28 | "f_rel35CL": -0.5124, 29 | "f_NT": -0.013692 30 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ne.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ne", 3 | "Z": 10, 4 | "weight": 20.179, 5 | "density": 0.0008391, 6 | "edges": 4, 7 | "E_edges": [ 8 | 0.8669, 9 | 0.045, 10 | 0.0183, 11 | 0.0183 12 | ], 13 | "f_relH82": -0.01249, 14 | "f_rel35CL": -0.0066, 15 | "f_NT": -0.0027186 16 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ni.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ni", 3 | "Z": 28, 4 | "weight": 58.69, 5 | "density": 8.876, 6 | "edges": 9, 7 | "E_edges": [ 8 | 8.3328, 9 | 1.0081, 10 | 0.8719, 11 | 0.8547, 12 | 0.1118, 13 | 0.0681, 14 | 0.0681, 15 | 0.0036, 16 | 0.0036 17 | ], 18 | "f_relH82": -0.12883, 19 | "f_rel35CL": -0.081, 20 | "f_NT": -0.0073281 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/O.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "O", 3 | "Z": 8, 4 | "weight": 15.9994, 5 | "density": 0.001331, 6 | "edges": 4, 7 | "E_edges": [ 8 | 0.532, 9 | 0.0237, 10 | 0.0071, 11 | 0.0071 12 | ], 13 | "f_relH82": -0.0077133, 14 | "f_rel35CL": -0.0042, 15 | "f_NT": -0.0021944 16 | } -------------------------------------------------------------------------------- /physics/matter/elements/Os.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Os", 3 | "Z": 76, 4 | "weight": 190.2, 5 | "density": 22.53, 6 | "edges": 21, 7 | "E_edges": [ 8 | 73.8708, 9 | 12.968, 10 | 12.385, 11 | 10.8709, 12 | 3.0485, 13 | 2.7922, 14 | 2.4572, 15 | 2.0308, 16 | 1.9601, 17 | 0.6543, 18 | 0.5465, 19 | 0.4682, 20 | 0.2894, 21 | 0.2728, 22 | 0.0463, 23 | 0.0463, 24 | 0.0837, 25 | 0.058, 26 | 0.0454, 27 | 0.00705265, 28 | 0.00602794 29 | ], 30 | "f_relH82": -1.5563, 31 | "f_rel35CL": -0.9192, 32 | "f_NT": -0.016659 33 | } -------------------------------------------------------------------------------- /physics/matter/elements/P.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "P", 3 | "Z": 15, 4 | "weight": 30.9738, 5 | "density": 1.82, 6 | "edges": 7, 7 | "E_edges": [ 8 | 2.1455, 9 | 0.1893, 10 | 0.1322, 11 | 0.1322, 12 | 0.0144615, 13 | 0.00638493, 14 | 0.00633669 15 | ], 16 | "f_relH82": -0.030566, 17 | "f_rel35CL": -0.018, 18 | "f_NT": -0.003985 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Pa.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pa", 3 | "Z": 91, 4 | "weight": 231.0359, 5 | "density": 15.34, 6 | "edges": 24, 7 | "E_edges": [ 8 | 112.601, 9 | 21.1046, 10 | 20.3137, 11 | 16.7331, 12 | 5.3669, 13 | 5.0009, 14 | 4.1738, 15 | 3.6112, 16 | 3.4418, 17 | 1.3871, 18 | 1.2243, 19 | 1.0067, 20 | 0.7434, 21 | 0.7082, 22 | 0.3712, 23 | 0.3595, 24 | 0.3096, 25 | 0.233624, 26 | 0.18305, 27 | 0.0966789, 28 | 0.0892408, 29 | 0.0454585, 30 | 0.0285451, 31 | 0.0203206 32 | ], 33 | "f_relH82": -2.5033, 34 | "f_rel35CL": -1.4526, 35 | "f_NT": -0.019663 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Pb.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pb", 3 | "Z": 82, 4 | "weight": 207.2, 5 | "density": 11.33, 6 | "edges": 23, 7 | "E_edges": [ 8 | 88.0045, 9 | 15.8608, 10 | 15.2, 11 | 13.0352, 12 | 3.8507, 13 | 3.5542, 14 | 3.0664, 15 | 2.5856, 16 | 2.484, 17 | 0.8936, 18 | 0.7639, 19 | 0.6445, 20 | 0.4352, 21 | 0.4129, 22 | 0.1429, 23 | 0.1381, 24 | 0.1473, 25 | 0.1048, 26 | 0.086, 27 | 0.0218, 28 | 0.0192, 29 | 0.0116904, 30 | 0.00491166 31 | ], 32 | "f_relH82": -1.9001, 33 | "f_rel35CL": -1.1136, 34 | "f_NT": -0.017802 35 | } -------------------------------------------------------------------------------- /physics/matter/elements/Pd.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pd", 3 | "Z": 46, 4 | "weight": 106.42, 5 | "density": 12.0, 6 | "edges": 14, 7 | "E_edges": [ 8 | 24.3503, 9 | 3.6043, 10 | 3.3303, 11 | 3.1733, 12 | 0.6699, 13 | 0.5591, 14 | 0.5315, 15 | 0.34, 16 | 0.3347, 17 | 0.0864, 18 | 0.0511, 19 | 0.0511, 20 | 0.00544663, 21 | 0.00501841 22 | ], 23 | "f_relH82": -0.43111, 24 | "f_rel35CL": -0.2682, 25 | "f_NT": -0.010908 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Pm.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pm", 3 | "Z": 61, 4 | "weight": 145.0, 5 | "density": 7.2, 6 | "edges": 18, 7 | "E_edges": [ 8 | 45.184, 9 | 7.4279, 10 | 7.0128, 11 | 6.4593, 12 | 1.6465, 13 | 1.4714, 14 | 1.3569, 15 | 1.0515, 16 | 1.0269, 17 | 0.3304, 18 | 0.2544, 19 | 0.236, 20 | 0.1204, 21 | 0.1204, 22 | 0.004, 23 | 0.0375, 24 | 0.0211, 25 | 0.0211 26 | ], 27 | "f_relH82": -0.88035, 28 | "f_rel35CL": -0.5334, 29 | "f_NT": -0.014078 30 | } -------------------------------------------------------------------------------- /physics/matter/elements/Po.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Po", 3 | "Z": 84, 4 | "weight": 209.0, 5 | "density": 9.3, 6 | "edges": 24, 7 | "E_edges": [ 8 | 93.105, 9 | 16.9393, 10 | 16.2443, 11 | 13.8138, 12 | 4.1494, 13 | 3.8541, 14 | 3.3019, 15 | 2.798, 16 | 2.683, 17 | 0.9953, 18 | 0.851, 19 | 0.705, 20 | 0.5002, 21 | 0.4734, 22 | 0.175344, 23 | 0.169362, 24 | 0.170906, 25 | 0.125695, 26 | 0.0983141, 27 | 0.0314, 28 | 0.0314, 29 | 0.0167777, 30 | 0.00755974, 31 | 0.00539477 32 | ], 33 | "f_relH82": -2.0248, 34 | "f_rel35CL": -1.1838, 35 | "f_NT": -0.01852 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Pr.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pr", 3 | "Z": 59, 4 | "weight": 140.9077, 5 | "density": 6.761, 6 | "edges": 18, 7 | "E_edges": [ 8 | 41.9906, 9 | 6.8348, 10 | 6.4404, 11 | 5.9643, 12 | 1.511, 13 | 1.3374, 14 | 1.2422, 15 | 0.9511, 16 | 0.931, 17 | 0.3045, 18 | 0.2363, 19 | 0.2176, 20 | 0.1132, 21 | 0.1132, 22 | 0.0035, 23 | 0.0374, 24 | 0.0223, 25 | 0.0223 26 | ], 27 | "f_relH82": -0.80832, 28 | "f_rel35CL": -0.4914, 29 | "f_NT": -0.013552 30 | } -------------------------------------------------------------------------------- /physics/matter/elements/Pt.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pt", 3 | "Z": 78, 4 | "weight": 195.08, 5 | "density": 21.41, 6 | "edges": 21, 7 | "E_edges": [ 8 | 78.3948, 9 | 13.8799, 10 | 13.2726, 11 | 11.5637, 12 | 3.296, 13 | 3.0265, 14 | 2.6454, 15 | 2.2019, 16 | 2.1216, 17 | 0.722, 18 | 0.6092, 19 | 0.519, 20 | 0.3308, 21 | 0.3133, 22 | 0.0743, 23 | 0.0711, 24 | 0.1017, 25 | 0.0653, 26 | 0.0517, 27 | 0.00743991, 28 | 0.00612538 29 | ], 30 | "f_relH82": -1.6659, 31 | "f_rel35CL": -0.9816, 32 | "f_NT": -0.017109 33 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ra.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ra", 3 | "Z": 88, 4 | "weight": 226.0254, 5 | "density": 5.0, 6 | "edges": 24, 7 | "E_edges": [ 8 | 103.922, 9 | 19.2367, 10 | 18.4843, 11 | 15.4444, 12 | 4.822, 13 | 4.4895, 14 | 3.7918, 15 | 3.2484, 16 | 3.1049, 17 | 1.2084, 18 | 1.0576, 19 | 0.8791, 20 | 0.6359, 21 | 0.6027, 22 | 0.2989, 23 | 0.2989, 24 | 0.2544, 25 | 0.2004, 26 | 0.1528, 27 | 0.0672, 28 | 0.0672, 29 | 0.0435, 30 | 0.0188, 31 | 0.0188 32 | ], 33 | "f_relH82": -2.2901, 34 | "f_rel35CL": -1.3326, 35 | "f_NT": -0.018795 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Rb.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rb", 3 | "Z": 37, 4 | "weight": 85.4678, 5 | "density": 1.529, 6 | "edges": 9, 7 | "E_edges": [ 8 | 15.1997, 9 | 2.0651, 10 | 1.8639, 11 | 1.8044, 12 | 0.3221, 13 | 0.2474, 14 | 0.2385, 15 | 0.1118, 16 | 0.1103 17 | ], 18 | "f_relH82": -0.25194, 19 | "f_rel35CL": -0.1584, 20 | "f_NT": -0.008787 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Re.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Re", 3 | "Z": 75, 4 | "weight": 186.207, 5 | "density": 20.98, 6 | "edges": 21, 7 | "E_edges": [ 8 | 71.6764, 9 | 12.5267, 10 | 11.9587, 11 | 10.5353, 12 | 2.9317, 13 | 2.6816, 14 | 2.3673, 15 | 1.9489, 16 | 1.8829, 17 | 0.625, 18 | 0.5179, 19 | 0.4444, 20 | 0.2737, 21 | 0.2602, 22 | 0.0406, 23 | 0.0406, 24 | 0.0828, 25 | 0.0456, 26 | 0.0346, 27 | 0.00606267, 28 | 0.00520913 29 | ], 30 | "f_relH82": -1.5033, 31 | "f_rel35CL": -0.8892, 32 | "f_NT": -0.016572 33 | } -------------------------------------------------------------------------------- /physics/matter/elements/Rh.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rh", 3 | "Z": 45, 4 | "weight": 102.9055, 5 | "density": 12.39, 6 | "edges": 14, 7 | "E_edges": [ 8 | 23.2199, 9 | 3.4119, 10 | 3.1461, 11 | 3.0038, 12 | 0.6271, 13 | 0.521, 14 | 0.4962, 15 | 0.3117, 16 | 0.307, 17 | 0.081, 18 | 0.0479, 19 | 0.0479, 20 | 0.0025, 21 | 0.0025 22 | ], 23 | "f_relH82": -0.40814, 24 | "f_rel35CL": -0.2544, 25 | "f_NT": -0.010795 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Rn.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rn", 3 | "Z": 86, 4 | "weight": 222.0, 5 | "density": 0.000923, 6 | "edges": 24, 7 | "E_edges": [ 8 | 98.404, 9 | 18.049, 10 | 17.3371, 11 | 14.6194, 12 | 4.482, 13 | 4.159, 14 | 3.538, 15 | 3.0215, 16 | 2.8924, 17 | 1.097, 18 | 0.929, 19 | 0.768, 20 | 0.5666, 21 | 0.537, 22 | 0.219631, 23 | 0.212588, 24 | 0.200831, 25 | 0.151771, 26 | 0.118817, 27 | 0.0486911, 28 | 0.044255, 29 | 0.0219397, 30 | 0.0105726, 31 | 0.00712588 32 | ], 33 | "f_relH82": -2.1548, 34 | "f_rel35CL": -1.257, 35 | "f_NT": -0.018276 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ru.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ru", 3 | "Z": 44, 4 | "weight": 101.07, 5 | "density": 12.39, 6 | "edges": 14, 7 | "E_edges": [ 8 | 22.1172, 9 | 3.224, 10 | 2.9669, 11 | 2.8379, 12 | 0.585, 13 | 0.4828, 14 | 0.4606, 15 | 0.2836, 16 | 0.2794, 17 | 0.0749, 18 | 0.0431, 19 | 0.0431, 20 | 0.002, 21 | 0.002 22 | ], 23 | "f_relH82": -0.38596, 24 | "f_rel35CL": -0.2406, 25 | "f_NT": -0.010508 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/S.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "S", 3 | "Z": 16, 4 | "weight": 32.06, 5 | "density": 2.07, 6 | "edges": 7, 7 | "E_edges": [ 8 | 2.472, 9 | 0.2292, 10 | 0.1648, 11 | 0.1648, 12 | 0.0176882, 13 | 0.00781363, 14 | 0.00773488 15 | ], 16 | "f_relH82": -0.035338, 17 | "f_rel35CL": -0.021, 18 | "f_NT": -0.0043804 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Sb.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sb", 3 | "Z": 51, 4 | "weight": 121.75, 5 | "density": 6.679, 6 | "edges": 14, 7 | "E_edges": [ 8 | 30.4912, 9 | 4.6983, 10 | 4.3804, 11 | 4.1322, 12 | 0.9437, 13 | 0.8119, 14 | 0.7656, 15 | 0.5369, 16 | 0.5275, 17 | 0.152, 18 | 0.0984, 19 | 0.0984, 20 | 0.0314, 21 | 0.0314 22 | ], 23 | "f_relH82": -0.55841, 24 | "f_rel35CL": -0.345, 25 | "f_NT": -0.01172 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Sc.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sc", 3 | "Z": 21, 4 | "weight": 44.9559, 5 | "density": 2.98, 6 | "edges": 7, 7 | "E_edges": [ 8 | 4.4928, 9 | 0.5004, 10 | 0.4067, 11 | 0.4022, 12 | 0.0538, 13 | 0.0323, 14 | 0.0323 15 | ], 16 | "f_relH82": -0.065705, 17 | "f_rel35CL": -0.0408, 18 | "f_NT": -0.0053814 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Se.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Se", 3 | "Z": 34, 4 | "weight": 78.96, 5 | "density": 4.78, 6 | "edges": 9, 7 | "E_edges": [ 8 | 12.6578, 9 | 1.6539, 10 | 1.4762, 11 | 1.4358, 12 | 0.2315, 13 | 0.1682, 14 | 0.1619, 15 | 0.0567, 16 | 0.0567 17 | ], 18 | "f_relH82": -0.20514, 19 | "f_rel35CL": -0.129, 20 | "f_NT": -0.0080314 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Si.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Si", 3 | "Z": 14, 4 | "weight": 28.0855, 5 | "density": 2.32, 6 | "edges": 6, 7 | "E_edges": [ 8 | 1.8389, 9 | 0.1487, 10 | 0.0992, 11 | 0.0992, 12 | 0.0113572, 13 | 0.00508305 14 | ], 15 | "f_relH82": -0.026197, 16 | "f_rel35CL": -0.0156, 17 | "f_NT": -0.0038284 18 | } -------------------------------------------------------------------------------- /physics/matter/elements/Sm.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sm", 3 | "Z": 62, 4 | "weight": 150.36, 5 | "density": 7.51, 6 | "edges": 18, 7 | "E_edges": [ 8 | 46.8342, 9 | 7.7368, 10 | 7.3118, 11 | 6.7162, 12 | 1.7228, 13 | 1.5407, 14 | 1.4198, 15 | 1.106, 16 | 1.0802, 17 | 0.3457, 18 | 0.2656, 19 | 0.2474, 20 | 0.129, 21 | 0.129, 22 | 0.0055, 23 | 0.0374, 24 | 0.0213, 25 | 0.0213 26 | ], 27 | "f_relH82": -0.91787, 28 | "f_rel35CL": -0.555, 29 | "f_NT": -0.014025 30 | } -------------------------------------------------------------------------------- /physics/matter/elements/Sn.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sn", 3 | "Z": 50, 4 | "weight": 118.69, 5 | "density": 7.3, 6 | "edges": 14, 7 | "E_edges": [ 8 | 29.2001, 9 | 4.4647, 10 | 4.1561, 11 | 3.9288, 12 | 0.8838, 13 | 0.7564, 14 | 0.7144, 15 | 0.4933, 16 | 0.4848, 17 | 0.1365, 18 | 0.0886, 19 | 0.0886, 20 | 0.0239, 21 | 0.0239 22 | ], 23 | "f_relH82": -0.53125, 24 | "f_rel35CL": -0.3282, 25 | "f_NT": -0.011555 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Sr.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sr", 3 | "Z": 38, 4 | "weight": 87.62, 5 | "density": 2.54, 6 | "edges": 12, 7 | "E_edges": [ 8 | 16.1046, 9 | 2.2163, 10 | 2.0068, 11 | 1.9396, 12 | 0.3575, 13 | 0.2798, 14 | 0.2691, 15 | 0.135, 16 | 0.1331, 17 | 0.0377, 18 | 0.0199, 19 | 0.0199 20 | ], 21 | "f_relH82": -0.2689, 22 | "f_rel35CL": -0.1692, 23 | "f_NT": -0.0090407 24 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ta.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ta", 3 | "Z": 73, 4 | "weight": 180.9479, 5 | "density": 16.624, 6 | "edges": 20, 7 | "E_edges": [ 8 | 67.4164, 9 | 11.6815, 10 | 11.1361, 11 | 9.8811, 12 | 2.708, 13 | 2.4687, 14 | 2.194, 15 | 1.7932, 16 | 1.7351, 17 | 0.5655, 18 | 0.4648, 19 | 0.4045, 20 | 0.2413, 21 | 0.2293, 22 | 0.025, 23 | 0.025, 24 | 0.0711, 25 | 0.0449, 26 | 0.0364, 27 | 0.0057 28 | ], 29 | "f_relH82": -1.4008, 30 | "f_rel35CL": -0.831, 31 | "f_NT": -0.016156 32 | } -------------------------------------------------------------------------------- /physics/matter/elements/Tb.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Tb", 3 | "Z": 65, 4 | "weight": 158.9254, 5 | "density": 8.214, 6 | "edges": 19, 7 | "E_edges": [ 8 | 51.9957, 9 | 8.708, 10 | 8.2516, 11 | 7.514, 12 | 1.9675, 13 | 1.7677, 14 | 1.6113, 15 | 1.275, 16 | 1.2412, 17 | 0.3979, 18 | 0.3102, 19 | 0.285, 20 | 0.147, 21 | 0.147, 22 | 0.0094, 23 | 0.0086, 24 | 0.039, 25 | 0.0254, 26 | 0.0254 27 | ], 28 | "f_relH82": -1.0366, 29 | "f_rel35CL": -0.6234, 30 | "f_NT": -0.014584 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/Tc.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Tc", 3 | "Z": 43, 4 | "weight": 98.0, 5 | "density": 11.48, 6 | "edges": 14, 7 | "E_edges": [ 8 | 21.044, 9 | 3.0425, 10 | 2.7932, 11 | 2.6769, 12 | 0.5476, 13 | 0.4449, 14 | 0.425, 15 | 0.2564, 16 | 0.2529, 17 | 0.0684, 18 | 0.0389, 19 | 0.0389, 20 | 0.00701158, 21 | 0.00672942 22 | ], 23 | "f_relH82": -0.36457, 24 | "f_rel35CL": -0.228, 25 | "f_NT": -0.01035 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Te.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Te", 3 | "Z": 52, 4 | "weight": 127.6, 5 | "density": 6.23, 6 | "edges": 14, 7 | "E_edges": [ 8 | 31.8138, 9 | 4.9392, 10 | 4.612, 11 | 4.3414, 12 | 1.006, 13 | 0.8697, 14 | 0.8187, 15 | 0.5825, 16 | 0.5721, 17 | 0.1683, 18 | 0.1102, 19 | 0.1102, 20 | 0.0398, 21 | 0.0398 22 | ], 23 | "f_relH82": -0.58644, 24 | "f_rel35CL": -0.3612, 25 | "f_NT": -0.011625 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Th.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Th", 3 | "Z": 90, 4 | "weight": 232.0381, 5 | "density": 11.7, 6 | "edges": 24, 7 | "E_edges": [ 8 | 109.651, 9 | 20.4721, 10 | 19.6932, 11 | 16.3003, 12 | 5.1823, 13 | 4.8304, 14 | 4.0461, 15 | 3.4908, 16 | 3.332, 17 | 1.3295, 18 | 1.1682, 19 | 0.9673, 20 | 0.7141, 21 | 0.6764, 22 | 0.3444, 23 | 0.3352, 24 | 0.2902, 25 | 0.2294, 26 | 0.1818, 27 | 0.0943, 28 | 0.0879, 29 | 0.0595, 30 | 0.049, 31 | 0.043 32 | ], 33 | "f_relH82": -2.4308, 34 | "f_rel35CL": -1.4118, 35 | "f_NT": -0.01915 36 | } -------------------------------------------------------------------------------- /physics/matter/elements/Ti.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ti", 3 | "Z": 22, 4 | "weight": 47.88, 5 | "density": 4.53, 6 | "edges": 7, 7 | "E_edges": [ 8 | 4.9664, 9 | 0.5637, 10 | 0.4615, 11 | 0.4555, 12 | 0.0603, 13 | 0.0346, 14 | 0.0346 15 | ], 16 | "f_relH82": -0.073171, 17 | "f_rel35CL": -0.045, 18 | "f_NT": -0.0055454 19 | } -------------------------------------------------------------------------------- /physics/matter/elements/Tl.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Tl", 3 | "Z": 81, 4 | "weight": 204.383, 5 | "density": 11.83, 6 | "edges": 22, 7 | "E_edges": [ 8 | 85.5304, 9 | 15.3467, 10 | 14.6979, 11 | 12.6575, 12 | 3.7041, 13 | 3.4157, 14 | 2.9566, 15 | 2.4851, 16 | 2.3893, 17 | 0.8455, 18 | 0.7213, 19 | 0.609, 20 | 0.4066, 21 | 0.3862, 22 | 0.1228, 23 | 0.1185, 24 | 0.1363, 25 | 0.0996, 26 | 0.0754, 27 | 0.0153, 28 | 0.0131, 29 | 0.00966483 30 | ], 31 | "f_relH82": -1.8396, 32 | "f_rel35CL": -1.0794, 33 | "f_NT": -0.01761 34 | } -------------------------------------------------------------------------------- /physics/matter/elements/Tm.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Tm", 3 | "Z": 69, 4 | "weight": 168.9342, 5 | "density": 9.294, 6 | "edges": 19, 7 | "E_edges": [ 8 | 59.3896, 9 | 10.1157, 10 | 9.6169, 11 | 8.648, 12 | 2.3068, 13 | 2.0898, 14 | 1.8845, 15 | 1.5146, 16 | 1.4677, 17 | 0.4717, 18 | 0.3859, 19 | 0.3366, 20 | 0.1796, 21 | 0.1796, 22 | 0.0053, 23 | 0.0053, 24 | 0.0532, 25 | 0.0323, 26 | 0.0323 27 | ], 28 | "f_relH82": -1.2098, 29 | "f_rel35CL": -0.7224, 30 | "f_NT": -0.01546 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/V.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "V", 3 | "Z": 23, 4 | "weight": 50.9415, 5 | "density": 6.1, 6 | "edges": 8, 7 | "E_edges": [ 8 | 5.4651, 9 | 0.6282, 10 | 0.5205, 11 | 0.5129, 12 | 0.0665, 13 | 0.0378, 14 | 0.0378, 15 | 0.0022 16 | ], 17 | "f_relH82": -0.081133, 18 | "f_rel35CL": -0.0504, 19 | "f_NT": -0.0056967 20 | } -------------------------------------------------------------------------------- /physics/matter/elements/W.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "W", 3 | "Z": 74, 4 | "weight": 183.85, 5 | "density": 19.3, 6 | "edges": 20, 7 | "E_edges": [ 8 | 69.525, 9 | 12.0998, 10 | 11.544, 11 | 10.2068, 12 | 2.8196, 13 | 2.5749, 14 | 2.281, 15 | 1.8716, 16 | 1.8092, 17 | 0.595, 18 | 0.4916, 19 | 0.4253, 20 | 0.2588, 21 | 0.2454, 22 | 0.0365, 23 | 0.0336, 24 | 0.0771, 25 | 0.0468, 26 | 0.0356, 27 | 0.0061 28 | ], 29 | "f_relH82": -1.4515, 30 | "f_rel35CL": -0.8598, 31 | "f_NT": -0.01634 32 | } -------------------------------------------------------------------------------- /physics/matter/elements/Xe.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Xe", 3 | "Z": 54, 4 | "weight": 131.29, 5 | "density": 0.005458, 6 | "edges": 14, 7 | "E_edges": [ 8 | 34.5614, 9 | 5.4528, 10 | 5.1037, 11 | 4.7822, 12 | 1.1446, 13 | 0.999, 14 | 0.937, 15 | 0.6854, 16 | 0.6723, 17 | 0.2081, 18 | 0.1467, 19 | 0.1467, 20 | 0.064, 21 | 0.064 22 | ], 23 | "f_relH82": -0.64519, 24 | "f_rel35CL": -0.396, 25 | "f_NT": -0.012184 26 | } -------------------------------------------------------------------------------- /physics/matter/elements/Y.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Y", 3 | "Z": 39, 4 | "weight": 88.9059, 5 | "density": 4.456, 6 | "edges": 12, 7 | "E_edges": [ 8 | 17.0384, 9 | 2.3725, 10 | 2.1555, 11 | 2.08, 12 | 0.3936, 13 | 0.3124, 14 | 0.3003, 15 | 0.1596, 16 | 0.1574, 17 | 0.0454, 18 | 0.0256, 19 | 0.0256 20 | ], 21 | "f_relH82": -0.28657, 22 | "f_rel35CL": -0.18, 23 | "f_NT": -0.0093851 24 | } -------------------------------------------------------------------------------- /physics/matter/elements/Yb.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Yb", 3 | "Z": 70, 4 | "weight": 173.04, 5 | "density": 6.953, 6 | "edges": 19, 7 | "E_edges": [ 8 | 61.3323, 9 | 10.4864, 10 | 9.9782, 11 | 8.9436, 12 | 2.3981, 13 | 2.173, 14 | 1.9498, 15 | 1.5763, 16 | 1.5278, 17 | 0.4872, 18 | 0.3967, 19 | 0.3435, 20 | 0.1981, 21 | 0.1849, 22 | 0.0063, 23 | 0.0063, 24 | 0.0541, 25 | 0.0234, 26 | 0.0234 27 | ], 28 | "f_relH82": -1.2559, 29 | "f_rel35CL": -0.7488, 30 | "f_NT": -0.015534 31 | } -------------------------------------------------------------------------------- /physics/matter/elements/Zn.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Zn", 3 | "Z": 30, 4 | "weight": 65.38, 5 | "density": 7.112, 6 | "edges": 9, 7 | "E_edges": [ 8 | 9.6586, 9 | 1.1936, 10 | 1.0428, 11 | 1.0197, 12 | 0.1359, 13 | 0.0866, 14 | 0.0866, 15 | 0.0081, 16 | 0.0081 17 | ], 18 | "f_relH82": -0.15183, 19 | "f_rel35CL": -0.0954, 20 | "f_NT": -0.0075516 21 | } -------------------------------------------------------------------------------- /physics/matter/elements/Zr.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Zr", 3 | "Z": 40, 4 | "weight": 91.22, 5 | "density": 6.494, 6 | "edges": 13, 7 | "E_edges": [ 8 | 17.9976, 9 | 2.5316, 10 | 2.3067, 11 | 2.2223, 12 | 0.4303, 13 | 0.3442, 14 | 0.3305, 15 | 0.1824, 16 | 0.18, 17 | 0.0513, 18 | 0.0287, 19 | 0.0287, 20 | 0.00402345 21 | ], 22 | "f_relH82": -0.30496, 23 | "f_rel35CL": -0.1914, 24 | "f_NT": -0.0096221 25 | } -------------------------------------------------------------------------------- /physics/matter/loadmaterialsample.m: -------------------------------------------------------------------------------- 1 | % READ ME, how to get a material 2 | 3 | % Fist: addpath(genpath()); 4 | % we wana 93WNiFe, play this: 5 | samplekeV = 10:0.5:140; 6 | material_93WNiFe = materialdefine(loadmaterial('93WNiFe'), samplekeV); 7 | % DONE! -------------------------------------------------------------------------------- /physics/matter/material/93WNiFe.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "93WNiFe", 3 | "density": 17.781, 4 | "method": "weight", 5 | "elements": { 6 | "W": 0.93, 7 | "Ni": 0.049, 8 | "Fe": 0.021 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /physics/matter/material/97WNiFe.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "97WNiFe", 3 | "density": 18.645, 4 | "method": "weight", 5 | "elements": { 6 | "W": 0.97, 7 | "Ni": 0.021, 8 | "Fe": 0.009 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /physics/matter/material/Alcohol.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alcohol", 3 | "density": 0.789, 4 | "method": "mol", 5 | "elements": { 6 | "C": 2, 7 | "H": 6, 8 | "O": 1 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /physics/matter/material/CorticalBone.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CorticalBone", 3 | "density": 1, 4 | "method": "weight", 5 | "elements": { 6 | "H": 339, 7 | "C": 1549, 8 | "N": 397, 9 | "O": 4407, 10 | "Na": 6, 11 | "Mg": 21, 12 | "P": 1019, 13 | "S": 31, 14 | "Cl": 10, 15 | "K": 3, 16 | "Ca": 2218, 17 | "Fe": 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /physics/matter/material/CorticalBone_ICRP.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CorticalBone(ICRP)", 3 | "density": 1, 4 | "method": "weight", 5 | "elements": { 6 | "H": 0.047234, 7 | "C": 0.144330, 8 | "N": 0.041990, 9 | "O": 0.446096, 10 | "Mg": 0.002200, 11 | "P": 0.104970, 12 | "S": 0.003150, 13 | "Ca": 0.209930, 14 | "Fe": 0.000100 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /physics/matter/material/Cranium.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cranium", 3 | "density": 1.6, 4 | "method": "weight", 5 | "elements": { 6 | "H": 493, 7 | "C": 2120, 8 | "N": 385, 9 | "O": 4409, 10 | "Na": 6, 11 | "Mg": 16, 12 | "P": 800, 13 | "S": 24, 14 | "Cl": 10, 15 | "K": 4, 16 | "Ca": 1732, 17 | "Fe": 2 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /physics/matter/material/FAPbI3.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FAPbI3", 3 | "density": 3.97, 4 | "method": "mol", 5 | "elements": { 6 | "Pb": 1, 7 | "I": 3, 8 | "C": 1, 9 | "N": 2, 10 | "H": 5 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /physics/matter/material/Gd2O2S.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gd2O2S", 3 | "density": 7.3, 4 | "method": "mol", 5 | "elements": { 6 | "Gd": 2, 7 | "O": 2, 8 | "S": 1 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /physics/matter/material/HA.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HA", 3 | "density": 1, 4 | "method": "mol", 5 | "elements": { 6 | "Ca": 5, 7 | "P": 3, 8 | "O": 13, 9 | "H": 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /physics/matter/material/MAPbBr3.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MAPbBr3", 3 | "density": 3.55, 4 | "method": "mol", 5 | "elements": { 6 | "Pb": 1, 7 | "Br": 3, 8 | "C": 1, 9 | "N": 1, 10 | "H": 6 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /physics/matter/material/PE.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PE", 3 | "density": 0.92, 4 | "method": "mol", 5 | "elements": { 6 | "C": 2, 7 | "H": 4 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /physics/matter/material/PMMA.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PMMA", 3 | "density": 1.18, 4 | "method": "mol", 5 | "elements": { 6 | "C": 5, 7 | "O": 2, 8 | "H": 8 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /physics/matter/material/PVC.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PVC", 3 | "density": 1.4, 4 | "method": "mol", 5 | "elements": { 6 | "C": 2, 7 | "H": 3, 8 | "Cl": 1 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /physics/matter/material/Sulfur.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "S", 3 | "density": 1.96, 4 | "method": "mol", 5 | "elements": { 6 | "S": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/air.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "air", 3 | "density": 0, 4 | "method": "mol", 5 | "elements": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /physics/matter/material/carbonfiber.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "carbon fiber", 3 | "density": 1.80, 4 | "method": "mol", 5 | "elements": { 6 | "C": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/crystalSi.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Si", 3 | "density": 2.33, 4 | "method": "mol", 5 | "elements": { 6 | "Si": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/foamedPE.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foamed PE", 3 | "density": 0.02, 4 | "method": "mol", 5 | "elements": { 6 | "C": 2, 7 | "H": 4 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /physics/matter/material/graphite.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "graphite", 3 | "density": 2.25, 4 | "method": "mol", 5 | "elements": { 6 | "C": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/metalAg.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Silver", 3 | "density": 10.49, 4 | "method": "mol", 5 | "elements": { 6 | "Ag": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/metalAl.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Al", 3 | "density": 2.6941, 4 | "method": "mol", 5 | "elements": { 6 | "Al": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/metalCU.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cu", 3 | "density": 8.960, 4 | "method": "mol", 5 | "elements": { 6 | "Cu": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/metalPb.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Pb", 3 | "density": 11.3437, 4 | "method": "mol", 5 | "elements": { 6 | "Pb": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/metalTi.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ti", 3 | "density": 4.53, 4 | "method": "mol", 5 | "elements": { 6 | "Ti": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/metalW.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Tungsten", 3 | "density": 19.25, 4 | "method": "mol", 5 | "elements": { 6 | "W": 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /physics/matter/material/steel301.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "steal 301", 3 | "density": 7.93, 4 | "method": "weight", 5 | "elements": { 6 | "Fe": 0.7285, 7 | "C": 0.0015, 8 | "Cr": 0.17, 9 | "Ni": 0.07, 10 | "Mn": 0.02, 11 | "Si": 0.01 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /physics/matter/material/teflon.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "teflon", 3 | "density": 2.18, 4 | "method": "mol", 5 | "elements": { 6 | "C": 1, 7 | "F": 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /physics/matter/material/vacuum.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vacuum", 3 | "density": 0, 4 | "method": "mol", 5 | "elements": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /physics/matter/material/water.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "water", 3 | "density": 1, 4 | "method": "mol", 5 | "elements": { 6 | "H": 2, 7 | "O": 1 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /physics/matter/material/water1100.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "water", 3 | "density": 1.1, 4 | "method": "mol", 5 | "elements": { 6 | "H": 2, 7 | "O": 1 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /physics/matter/material/water2000.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "name": "water", 3 | "density": 2.0, 4 | "method": "mol", 5 | "elements": { 6 | "H": 2, 7 | "O": 1 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /physics/spectrumresample.m: -------------------------------------------------------------------------------- 1 | function sampledata = spectrumresample(spectsample, spectdata, samplekeV) 2 | % resampling the spectrum data by the samplekeV 3 | % sampledata = spectrumresample(spectsample, spectdata, samplekeV); 4 | % typically 5 | % source.spectrum{ii} = spectrumresample(spectdata(:,1), spectdata(:,2), samplekeV); 6 | % It is not interplation. 7 | 8 | dx = mean(diff(spectsample)); 9 | dy = mean(diff(samplekeV)); 10 | 11 | Nx = length(spectsample); 12 | Ny = length(samplekeV); 13 | 14 | spectdata = [0; spectdata(:); 0]; 15 | t0 = (samplekeV(1) - spectsample(1) - dy + dx)/dx; 16 | d = dy/dx; 17 | sampledata = samplekeV.*0; 18 | 19 | for ii = 1:Ny 20 | tm = t0 + (ii-1/2)*d + 1/2; 21 | tn = t0 + (ii+1/2)*d - 1/2; 22 | 23 | m = max(floor(tm), 0); 24 | n = min(ceil(tn), Nx+1); 25 | if n<0 26 | % out of lower boundary 27 | continue; 28 | elseif m>Nx+1 29 | % out of upper boundary 30 | break; 31 | end 32 | sampledata(ii) = sum(spectdata(m+1:n+1)) - spectdata(m+1)*(tm-m) + spectdata(n+1)*(tn-n); 33 | end 34 | 35 | end -------------------------------------------------------------------------------- /physics/tube/loadsourcespectrumsample.m: -------------------------------------------------------------------------------- 1 | % READ ME, how to get the spectrum of a KVp 2 | 3 | % Fist: addpath(genpath()); 4 | % we wana 120KVp, play this: 5 | KVp = 120; 6 | samplekeV = 10:0.5:140; 7 | tubedata = loaddata('tube_spectrumdata_60-160_v1.0.corr'); 8 | tubedata.main = reshape(tubedata.main, [], tubedata.KVnumber); 9 | spectdata = reshape(tubedata.main(:, (tubedata.KVtag == KVp)), [], 2); 10 | spectrum = interp1(spectdata(:,1), spectdata(:,2), samplekeV, 'linear', 0); 11 | % or spectrum = spectrumresample(spectdata(:,1), spectdata(:,2), samplekeV); 12 | 13 | % DONE! -------------------------------------------------------------------------------- /physics/tube/tube_spectrumdata2_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/physics/tube/tube_spectrumdata2_v1.0.corr -------------------------------------------------------------------------------- /physics/tube/tube_spectrumdata_60-150_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/physics/tube/tube_spectrumdata_60-150_v1.0.corr -------------------------------------------------------------------------------- /physics/tube/tube_spectrumdata_60-160_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/physics/tube/tube_spectrumdata_60-160_v1.0.corr -------------------------------------------------------------------------------- /physics/tube/tube_spectrumdata_70-150_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/physics/tube/tube_spectrumdata_70-150_v1.0.corr -------------------------------------------------------------------------------- /physics/tube/tube_spectrumdata_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/physics/tube/tube_spectrumdata_v1.0.corr -------------------------------------------------------------------------------- /physics/weightofslicemerge.m: -------------------------------------------------------------------------------- 1 | function w = weightofslicemerge(detector) 2 | % weighting in slice merging 3 | % w = weightofslicemerge(detector); 4 | 5 | w = detectorslicemerge(ones(detector.Nslice, 1), 1, detector.Nslice, detector.slicemerge, 'sum'); 6 | w = w(detector.slicemerge); 7 | w = reshape(1./w.*detector.mergescale, 1, detector.Nslice); 8 | 9 | end -------------------------------------------------------------------------------- /recon/external/reconnode_CRISAxialBackprojection.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/recon/external/reconnode_CRISAxialBackprojection.m -------------------------------------------------------------------------------- /recon/external/reconnode_CRISAxialFBP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/recon/external/reconnode_CRISAxialFBP.m -------------------------------------------------------------------------------- /recon/lib/DFSmidchannel.m: -------------------------------------------------------------------------------- 1 | function mid_DFS = DFSmidchannel(mid_U, longorshot) 2 | % hard code of DFS mode, should be configurable 3 | 4 | if longorshot 5 | a = 3/8; 6 | b = -1/8; 7 | else 8 | a = 1/8; 9 | b = -3/8; 10 | end 11 | 12 | La = floor(mid_U+a); 13 | Da = mid_U+a - La; 14 | Lb = floor(mid_U+b); 15 | Db = mid_U+b - Lb; 16 | 17 | mid_DFS = La + Lb + min(Da, Db)*2; 18 | 19 | end -------------------------------------------------------------------------------- /recon/lib/QDOorder.m: -------------------------------------------------------------------------------- 1 | function [a1, a2] = QDOorder(N, m) 2 | 3 | % % debug 4 | % N = 11; 5 | % m = 4.13; 6 | % dd = (1:N).' - m; 7 | 8 | minl = floor((1-m)*2); 9 | minr = floor((m-N)*2); 10 | maxl = floor((N-m)*2); 11 | maxr = floor((m-1)*2); 12 | 13 | minlr = max(minl, minr) - 1; 14 | maxlr = min(maxl, maxr) + 1; 15 | 16 | xx = 1:N; 17 | a1 = floor((xx-m).*2); 18 | a2 = floor((-xx+m).*2); 19 | a1(a1maxlr) = nan; 20 | a2(a2maxlr) = nan; 21 | a1 = a1 - minlr + 1; 22 | a2 = a2 - minlr + 1; 23 | 24 | end 25 | 26 | % % debug 27 | % s1 = ~isnan(a1); 28 | % s2 = ~isnan(a2); 29 | % N_QDO = max([a1, a2]); 30 | % d_QDO = nan(N_QDO, 1); 31 | % d_QDO(a1(s1)) = dd(s1); 32 | % d_QDO(a2(s2)) = -dd(s2); 33 | 34 | -------------------------------------------------------------------------------- /recon/lib/TV/TVoptions.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/recon/lib/TV/TVoptions.m -------------------------------------------------------------------------------- /recon/lib/axialchordhomeomorph.m: -------------------------------------------------------------------------------- 1 | function t = axialchordhomeomorph(eta, zeta, Nslice) 2 | % prepare for homeomorphic axial reconstruction of 'chord' beam 3 | % t = axialchordhomeomorph(eta, zeta, Nslice); 4 | 5 | % inputs 6 | dsize = size(eta); 7 | if dsize(end)==1 8 | dsize = dsize(1:end-1); 9 | end 10 | ZgridA = -Nslice+1:Nslice; 11 | eta = eta(:); 12 | zeta = zeta(:); 13 | 14 | % dz and gap 15 | % 0 16 | dz_0 = (1+zeta./sqrt(1-eta.^2)); 17 | % pi 18 | dz_pi = (1-zeta./sqrt(1-eta.^2)); 19 | % gap 20 | gap = ones(size(eta)); 21 | 22 | % t 23 | t = nan([dsize Nslice*2], class(eta)); 24 | % 0 25 | s_0 = dz_0 >= abs(ZgridA.*2-1)./(Nslice-1); 26 | t_tmp = (ZgridA-1/2)./dz_0+1/2; 27 | t(s_0) = t_tmp(s_0); 28 | % pi 29 | s_pi = dz_pi >= (Nslice*2-abs(ZgridA.*2-1))./(Nslice-1); 30 | t_tmp = Nslice.*sign(ZgridA-1/2)+1/2 + (-Nslice.*sign(ZgridA-1/2)+ZgridA-1/2)./dz_pi; 31 | t(s_pi) = t_tmp(s_pi); 32 | % gap 33 | s_gap = ~s_0 & ~s_pi; 34 | t_tmp = ((Nslice-1)/2).*sign(ZgridA-1/2)+1/2 + (ZgridA-1/2 - dz_0.*(((Nslice-1)/2).*sign(ZgridA-1/2)))./gap; 35 | t(s_gap) = t_tmp(s_gap); 36 | 37 | t = reshape(t, [dsize Nslice*2]); 38 | end -------------------------------------------------------------------------------- /recon/lib/backprojection/helicalviewexta.m: -------------------------------------------------------------------------------- 1 | function [viewextra_full, viewextra_pi] = helicalviewexta(Nslice, pitch, effRadius, Nviewprot) 2 | % subfunction of helicalprepare.m and cradleprepare.m 3 | 4 | sigma_z = (Nslice-1)/Nslice; 5 | absPitch = abs(pitch); 6 | 7 | t0 = fzero(@(x) (effRadius + sqrt((1-effRadius^2*x^2)/(1-x^2)) )*x*sigma_z - absPitch/pi, 0); 8 | Z0 = asin(effRadius*t0) * absPitch/(pi*2) + (sqrt(1-effRadius^2*t0^2) + effRadius*sqrt(1-t0^2)) * sigma_z/2; 9 | viewextra_full = Z0/absPitch*Nviewprot; 10 | 11 | % pi-line recon condition 12 | t_pi = fzero(@(x) (effRadius^2 * x * sqrt(1-x^2)/(1-effRadius^2*x^2) - x/sqrt(1-x^2))*pi/2 - 1, 0); 13 | Zpi = (1+effRadius*sqrt( (1-t_pi^2)/(1-effRadius^2*t_pi^2) ) )/4 - asin(t_pi*effRadius)/pi/2; 14 | viewextra_pi = Zpi*Nviewprot; 15 | 16 | end -------------------------------------------------------------------------------- /recon/lib/bonecorrEdgeEnhance.m: -------------------------------------------------------------------------------- 1 | function ImgOut = bonecorrEdgeEnhance(ImgIn, minValue, pixelsize, edgekernel, edgescale) 2 | % enhance the bone 3 | 4 | [Ny, Nx, Nimg] = size(ImgIn); 5 | 6 | % D1 = (ImgIn>minValue).*2.0-1.0; 7 | % D1 = fft2(D1); 8 | 9 | [X, Y] = meshgrid([0:Nx/2 -Nx/2+1:-1]./Nx, [0:Ny/2 -Ny/2+1:-1]./Ny); 10 | sigma = pixelsize/edgekernel; 11 | f1 = exp(-(X.^2+Y.^2)./(sigma.^2)); 12 | 13 | D1 = ifft2(fft2((ImgIn>minValue).*1.0).*f1, 'symmetric'); 14 | D2 = (abs(D1(2:end-1,3:end, :) - D1(2:end-1, 1:end-2, :)) + ... 15 | abs(D1(3:end, 2:end-1, :) - D1(1:end-2, 2:end-1, :)))./pixelsize; 16 | 17 | D3 = ImgIn.*0; 18 | D3(2:end-1,2:end-1, :) = D1(2:Nx-1, 2:Ny-1, :).*D2; 19 | D3(D3<0) = 0; 20 | 21 | img2inh = ImgIn - minValue; 22 | img2inh(img2inh<0) = 0; 23 | ImgOut = ImgIn + img2inh.*D3.*edgescale; 24 | end -------------------------------------------------------------------------------- /recon/lib/bonecorrEdgeEnhance3D.m: -------------------------------------------------------------------------------- 1 | function ImgOut = bonecorrEdgeEnhance3D(ImgIn, minValue, pixelsize, edgekernel, edgescale) 2 | % enhance the bone 3 | 4 | [Ny, Nx, Nz] = size(ImgIn); 5 | if size(pixelsize(:),1) == 1 6 | pixelsize = repmat(pixelsize, 3, 1); 7 | end 8 | 9 | [X, Y, Z] = meshgrid([0:Nx/2 -Nx/2+1:-1]./Nx, [0:Ny/2 -Ny/2+1:-1]./Ny, [0:Nz/2 -Nz/2+1:-1]./Nz); 10 | sigma = pixelsize./edgekernel; 11 | f1 = exp(-((X./sigma(1)).^2+(Y./sigma(2)).^2+(Z./sigma(3)).^2)); 12 | 13 | D1 = ifftn(fftn((ImgIn>minValue).*1.0).*f1, 'symmetric'); 14 | D2 = abs(D1(3:end, 2:end-1, 2:end-1) - D1(1:end-2, 2:end-1, 2:end-1))./pixelsize(1) + ... 15 | abs(D1(2:end-1, 3:end, 2:end-1) - D1(2:end-1, 1:end-2, 2:end-1))./pixelsize(2) + ... 16 | abs(D1(2:end-1, 2:end-1, 3:end) - D1(2:end-1, 2:end-1, 1:end-2))./pixelsize(3); 17 | 18 | 19 | % D2 = (abs(D1(2:end-1,3:end, :) - D1(2:end-1, 1:end-2, :)) + abs(D1(3:end, 2:end-1, :) - D1(1:end-2, 2:end-1, :)))./pixelsize; 20 | 21 | D3 = ImgIn.*0; 22 | D3(2:end-1,2:end-1, 2:end-1) = D1(2:Ny-1, 2:Nx-1, 2:Nz-1).*D2; 23 | D3(D3<0) = 0; 24 | 25 | img2inh = ImgIn - minValue; 26 | img2inh(img2inh<0) = 0; 27 | ImgOut = ImgIn + img2inh.*D3.*edgescale; 28 | end -------------------------------------------------------------------------------- /recon/lib/detpos2angle.m: -------------------------------------------------------------------------------- 1 | function [detangle, eqangle] = detpos2angle(detposition, focalposition) 2 | % [detangle, eqangle] = detpos2angle(detposition, focalposition) 3 | % where the 'detposition' could be SYS.detector.position(1:Npixel, :); 4 | % and the 'focalposition' could be SYS.source.focalposition(1, :); 5 | 6 | Npixel = size(detposition, 1); 7 | % angles 8 | detangle = atan2(detposition(1:Npixel, 2) - focalposition(2), ... 9 | detposition(1:Npixel, 1) - focalposition(1)); 10 | midangle = atan2(-focalposition(2), -focalposition(1)); 11 | 12 | midindex = find(detangle1 18 | eta_C = recon.center(1).*sin(viewangle) - recon.center(2).*cos(viewangle); 19 | indexstart_p = floor(recon.midchannel + (-recon.effFOV/2 + eta_C)./recon.delta_d); 20 | indexstart_n = floor(recon.midchannel*2 - indexstart_p); 21 | indexstart = [indexstart_p(:) indexstart_n(:)]; 22 | end 23 | 24 | 25 | end -------------------------------------------------------------------------------- /recon/lib/getBoneImg.m: -------------------------------------------------------------------------------- 1 | function ImgOut = getBoneImg(ImgIn, BoneCurve) 2 | 3 | % % old codes 4 | % minValue = min(BoneCurve(:,1)); 5 | % maxValue = max(BoneCurve(:,1)); 6 | % ImgIn(ImgIn < minValue) = 0; 7 | % ImgIn(ImgIn > maxValue) = maxValue; 8 | % idx = find(ImgIn > 0); 9 | % ImgIn(idx)=interp1(BoneCurve(:,1), BoneCurve(:,2), ImgIn(idx)); 10 | % ImgOut = ImgIn; 11 | 12 | minValue = min(BoneCurve(:,1)); 13 | ImgOut = interp1(BoneCurve(:,1), BoneCurve(:,2), ImgIn, 'linear', 'extrap'); 14 | ImgOut = ImgOut.*(ImgIn>minValue); 15 | 16 | end 17 | -------------------------------------------------------------------------------- /recon/lib/idealfanangles.m: -------------------------------------------------------------------------------- 1 | function [equalfan, dfan, idealphi, midU_phi] = idealfanangles(fanangles, mid_U, delta_d) 2 | % ideal equal fan and ideal equal radial phi 3 | 4 | % size 5 | [Npixel, Nslice] = size(fanangles); 6 | % I know for flying focal, the Npixel is Npixel*Nfocal 7 | 8 | % ideal equal fan angle 9 | fanangles_mean = mean(fanangles, 2); 10 | pixelindex = 1:Npixel; 11 | dfan = ((pixelindex-mid_U)*fanangles_mean) / sum((pixelindex-mid_U).^2); 12 | equalfan = dfan.*((1:Npixel)'-mid_U); 13 | 14 | % ideal phi (equal radial) 15 | t0 = mod(mid_U, 1); 16 | delta_phi = delta_d*sign(dfan); 17 | 18 | t1 = ceil(sin(equalfan(1))/delta_phi + t0); 19 | t2 = floor(sin(equalfan(end))/delta_phi + t0); 20 | idealphi = asin(((t1:t2)'-t0).*delta_phi); 21 | % I know the delta_d = hx_ISO/Nfocal/SID; 22 | 23 | % midU of phi 24 | midU_phi = -t1+1+t0; 25 | 26 | end -------------------------------------------------------------------------------- /recon/lib/imagereorder.m: -------------------------------------------------------------------------------- 1 | function img = imagereorder(img, Nrow, reorderflag) 2 | % reorder and ' the images after BP 3 | % img = imagereorder(img, Nrow, reorderflag); 4 | % normally, img is dataflow.image{iseries}; 5 | % Nrow is prmflow.recon.Nslice; 6 | % reorderflag is protocol.couchdirection<0 & Axial 7 | 8 | if reorderflag 9 | % do nothing 10 | return; 11 | end 12 | 13 | Nimg = size(img, 3); 14 | index = flipud(reshape(1:Nimg, Nrow, [])); 15 | img = img(:,:,index); 16 | 17 | end -------------------------------------------------------------------------------- /recon/lib/loadfilter.m: -------------------------------------------------------------------------------- 1 | function H = loadfilter(filter, Npixel, delta_d) 2 | % load filter 3 | % H = loadfilter(filter, Npixel, delta_d); 4 | 5 | % design filter 6 | if isfield(filter, 'name') || ischar(filter) 7 | % design filter by filter's name 8 | if isfield(filter, 'freqscale') 9 | freqscale = filter.freqscale; 10 | else 11 | freqscale = 1.0; 12 | end 13 | if ischar(filter) 14 | filtername = filter; 15 | else 16 | filtername = filter.name; 17 | end 18 | H = filterdesign(filtername, Npixel, delta_d, freqscale); 19 | elseif isfield(filter, 'file') 20 | % load filter from a file 21 | if ~exist(filter.file, 'file') 22 | error('Can not find filter file: %s', filter.file); 23 | end 24 | fid = fopen(filter.file, 'r'); 25 | H = fread(fid, inf, 'single'); 26 | fclose(fid); 27 | H = H(:); 28 | else 29 | H = struct(); 30 | fields = fieldnames(filter); 31 | for ii = 1:length(fields) 32 | if isstruct(filter.(fields{ii})) 33 | Hi = loadfilter(filter.(fields{ii}), Npixel, delta_d); 34 | if ~isempty(Hi) 35 | H.(fields{ii}) = Hi; 36 | end 37 | end 38 | end 39 | end 40 | 41 | end -------------------------------------------------------------------------------- /recon/lib/ntimesup.m: -------------------------------------------------------------------------------- 1 | function y = ntimesup(x, n, Gamma) 2 | 3 | x = squeeze(x); 4 | y = repmat(x.*0, 1, 1, n); 5 | 6 | n = cast(n, 'like', Gamma); 7 | a = (0:n-1)./n; 8 | b = 1/2-sqrt(1+4.*a.*(1-a))./2; 9 | c = Gamma(1)./sqrt(1-a.*(1-a).*Gamma(2)); 10 | t = [(2-a-b+(2-a.*3).*c)./4 (b+(1-a).*(1-c))./4]; 11 | 12 | u = reshape(x(:)*t, [size(x) n*2]); 13 | y(:,:, 1) = u(:,:, 1) + [u(1, :, n+1); u(1:end-1, :, n+1)] + [u(2:end, :, n+1); u(end, :, n+1)]; 14 | 15 | for ii = 2:n 16 | y(:,:, ii) = [u(1, :, ii+n); u(1:end-1, :, ii+n)] + u(:,:, ii) + [u(2:end, :, n+2-ii); u(end, :, n+2-ii)] + ... 17 | [u(3:end, :, n*2+2-ii); u(end, :, n*2+2-ii); u(end, :, n*2+2-ii)]; 18 | end 19 | 20 | y = reshape(permute(y, [3 1 2]), size(x).*[n 1]); 21 | 22 | end -------------------------------------------------------------------------------- /recon/lib/offfocal/offfocalsinckernel.m: -------------------------------------------------------------------------------- 1 | function kernel = offfocalsinckernel(offintensity, offwidth, offedge, offsample) 2 | % subfunction of off-focal kernel, sinc style 3 | % kernel = offfocalsinckernel(offintensity, offwidth, offedge, offsample) 4 | % NOTE: the offwidth should be the scaled value: offwidth = corr.offwidth/SID/(max(t_off)-min(t_off)); 5 | 6 | % regule the shape 7 | offintensity = offintensity(:)'; 8 | offwidth = offwidth(:)'; 9 | offedge = offedge(:)'; 10 | 11 | tt = [0:offsample/2, -offsample/2+1:-1]'; 12 | kernel = sinc(tt * offwidth).*offintensity; 13 | % I know offwidth = offwidth/SID/(max(t_off)-min(t_off)); 14 | 15 | % edge smooth 16 | edge_smooth = 1./(1+exp((-offedge+abs(tt)./(offsample/2)).*(10./(0.5-abs(offedge-0.5))))); 17 | edge_smooth = fillmissing(edge_smooth, 'nearest'); 18 | 19 | kernel = sum(kernel.*edge_smooth, 2); 20 | 21 | end -------------------------------------------------------------------------------- /recon/lib/offfocal/offfocalzcross.m: -------------------------------------------------------------------------------- 1 | function A = offfocalzcross(A, crossrate) 2 | % a subfunction of the off-focal correction 3 | % A = offfocalzcross(A, zrate); 4 | % A shall in shape (Npixel, Nslice, Nview); 5 | % zrate \in [0 1], which should be SDD*(SID-d)/SID/(SDD-d) where d is the distance from focal spot to collimator blades 6 | 7 | % size 8 | [Npixel, Nslice, Nview] = size(A); 9 | % permute 10 | A = reshape(permute(A, [2 1 3]), Nslice, []); 11 | % cross matrix 12 | Crs = offfocalzcrossmatrix(Nslice, crossrate); 13 | % apply 14 | A = Crs*A; 15 | % permute back 16 | A = permute(reshape(A, Nslice, Npixel, Nview), [2 1 3]); 17 | % done 18 | 19 | end -------------------------------------------------------------------------------- /recon/lib/omiga4table.m: -------------------------------------------------------------------------------- 1 | function interptable = omiga4table(Coeffgamma, Nfourp) 2 | % prepare the table for Sobolev space linearized omiga-4-points interpoloation method 3 | % interptable = omiga4table(Coeffgamma, Nfourp); 4 | % boring code, please look up the omiga4interp.m. 5 | 6 | % alpha-beta interp prepare 7 | Nfourp = single(Nfourp); 8 | index_intp = 1:Nfourp+1; 9 | alpha_intp = single(linspace(0, 1, Nfourp+1)'); 10 | beta_intp = 1/2-sqrt(1+alpha_intp.*(1-alpha_intp).*4)./2; 11 | fourpoint = [(1+alpha_intp-beta_intp)./2 (alpha_intp+beta_intp)./2 ... 12 | (Coeffgamma(1)/4)./sqrt(1-alpha_intp.*(1-alpha_intp).*Coeffgamma(2))]; 13 | 14 | % to return 15 | interptable.Nfourp = Nfourp; 16 | interptable.fourpointindex = index_intp; 17 | interptable.fourpoint = fourpoint; 18 | interptable.convL = single([-1 2 -1]); 19 | 20 | end 21 | -------------------------------------------------------------------------------- /recon/lib/recon/initialimagehead.m: -------------------------------------------------------------------------------- 1 | function imagehead = initialimagehead(poolsize) 2 | 3 | if nargin<1 || ~isavail(poolsize) 4 | poolsize = 0; 5 | end 6 | 7 | imagehead = struct(); 8 | if ~isfield(imagehead, 'InstanceNumber') 9 | % DICOM tag, index of the image, start from 1 10 | imagehead.InstanceNumber = zeros(1, poolsize, 'int32'); 11 | end 12 | if ~isfield(imagehead, 'imagecenter') 13 | % XYZ position of the imagecenter to ISO 14 | imagehead.imagecenter = zeros(3, poolsize, 'single'); 15 | end 16 | if ~isfield(imagehead, 'reconcenter') 17 | % reconcenter_2DBP 18 | imagehead.reconcenter = zeros(3, poolsize, 'single'); 19 | % the center of the ring artifacts 20 | end 21 | if ~isfield(imagehead, 'Shot_Number') 22 | % shot index ? 23 | imagehead.Shot_Number = zeros(1, poolsize, 'int32'); 24 | end 25 | if ~isfield(imagehead, 'SliceLocation') 26 | % DICOM tag, Z position of the imagecenter while couch on zero 27 | imagehead.SliceLocation = zeros(1, poolsize, 'single'); 28 | end 29 | if ~isfield(imagehead, 'ImagePositionPatient') 30 | % DICOM tag, patient sight image position 31 | imagehead.ImagePositionPatient = zeros(3, poolsize, 'single'); 32 | end 33 | 34 | 35 | end -------------------------------------------------------------------------------- /recon/lib/rthetatrans.m: -------------------------------------------------------------------------------- 1 | function raw = rthetatrans(img, varargin) 2 | % r-theta transform of the img 3 | % raw = rthetatrans(img, center, Ntheta, d, flag_even); 4 | % or, raw = rthetatrans(img); 5 | 6 | % image size 7 | [Ny, Nx, Nrow] = size(img); 8 | 9 | % default inputs 10 | % center Ntheta d flag_even 11 | defaultinput = {zeros(Nrow, 2), 192, 1.0, true }; 12 | % input coeffients 13 | [center, Ntheta, d, flag_even] = cleaninputarg(defaultinput, varargin{:}); 14 | % rep center 15 | if size(center, 1) == 1 16 | center = repmat(center, Nrow, 1); 17 | end 18 | 19 | % XY grid of image 20 | Xa = (-(Nx-1)/2 : (Nx-1)/2) - center(:, 1); 21 | Ya = (-(Ny-1)/2 : (Ny-1)/2) - center(:, 2); 22 | % theta grid 23 | Vb = (0:Ntheta-1).*pi/Ntheta - pi/2; 24 | % R grid 25 | Nb = ceil(max(Nx, Ny)/d*sqrt(2)/2)*2; 26 | if ~flag_even 27 | Nb = Nb+1; 28 | end 29 | Rb = (-(Nb-1)/2 : (Nb-1)/2).*d; 30 | 31 | % interp target 32 | Xb = Rb(:) * cos(Vb); 33 | Yb = Rb(:) * sin(Vb); 34 | 35 | % interp 2D 36 | raw = zeros(Nb, Ntheta, Nrow, 'like', img); 37 | for irow = 1:Nrow 38 | raw(:, :, irow) = interp2(Xa(irow, :), Ya(irow, :), img(:, :, irow), Xb, Yb); 39 | end 40 | % done 41 | 42 | end -------------------------------------------------------------------------------- /recon/nodes/reconnode_Helicalrebin.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_Helicalrebin(dataflow, prmflow, status) 2 | % recon node, Helical rebin 3 | % [dataflow, prmflow, status] = reconnode_Helicalrebin(dataflow, prmflow, status); 4 | % Support (X)DFS, gantry tilt, NO QDO 5 | 6 | % Copyright Dier Zhang 7 | % 8 | % Licensed under the Apache License, Version 2.0 (the "License"); 9 | % you may not use this file except in compliance with the License. 10 | % You may obtain a copy of the License at 11 | % 12 | % http://www.apache.org/licenses/LICENSE-2.0 13 | % 14 | % Unless required by applicable law or agreed to in writing, software 15 | % distributed under the License is distributed on an "AS IS" BASIS, 16 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | % See the License for the specific language governing permissions and 18 | % limitations under the License. 19 | 20 | % not prepared? 21 | if ~status.pipeline.(status.nodename).prepared 22 | [dataflow, prmflow, status] = reconnode_helicalrebinprepare(dataflow, prmflow, status); 23 | status.pipeline.(status.nodename).prepared = true; 24 | end 25 | 26 | % call Rebin node 27 | [dataflow, prmflow, status] = reconnode_Rebin(dataflow, prmflow, status); 28 | 29 | end 30 | -------------------------------------------------------------------------------- /recon/nodes/reconnode_ballcali.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/recon/nodes/reconnode_ballcali.m -------------------------------------------------------------------------------- /recon/pipelinelib/branchpooltrace.m: -------------------------------------------------------------------------------- 1 | function pipepool = branchpooltrace(pipepool, nodename, nextnode, opterator, branchnode, branchindex) 2 | % recode the trace of the pools 3 | % dataflow.pipepool = branchpooltrace(pipepool, nodename, nextnode, opterator, branchnode, branchindex) 4 | 5 | 6 | for ii = 1 : length(branchnode) 7 | if isempty(branchnode{ii}) 8 | continue; 9 | end 10 | if ~strcmp(branchnode{ii}, nextnode) 11 | t = length(pipepool.(branchnode{ii})(branchindex(ii)).trace); 12 | pipepool.(branchnode{ii})(branchindex(ii)).trace(t+1).operator = [nodename ' ' opterator]; 13 | pipepool.(branchnode{ii})(branchindex(ii)).trace(t+1) = poolmirror(pipepool.(branchnode{ii})(branchindex(ii)), ... 14 | pipepool.(branchnode{ii})(branchindex(ii)).trace(t+1)); 15 | end 16 | end 17 | 18 | 19 | -------------------------------------------------------------------------------- /recon/pipelinelib/indexinoutmap.m: -------------------------------------------------------------------------------- 1 | function [indexIn, indexOut] = indexinoutmap(Nin, Nout, Rely, D) 2 | % help to set the maping index from the input to output 3 | 4 | indexIn = max(1 + Rely(2) + D, 1) : min(Nout + Rely(2) + D, Nin + Rely(1) + Rely(2)); 5 | indexOut = max(1 - Rely(2) - D, 1) : min(Nout, Nin + Rely(1) - D); 6 | 7 | 8 | end -------------------------------------------------------------------------------- /recon/pipelinelib/inputbranchpool.m: -------------------------------------------------------------------------------- 1 | function scp = inputbranchpool(scp, pipepool, branchindex, currnode, poolindex, readnumber) 2 | % the prio-step of the branch input pools, 3 | % status.currentjob.pipeline = inputbranchpool(status.currentjob.pipeline, dataflow.pipepool, branchindex, currnode, [], ... 4 | % readnumber); 5 | % the scp shall be the status.currentjob.pipeline 6 | 7 | if isempty(poolindex) 8 | poolindex = branchindex + 1; 9 | end 10 | if pipepool.(currnode)(poolindex).iscarried 11 | carrynode = pipepool.(currnode)(poolindex).carrynode; 12 | carryindex = pipepool.(currnode)(poolindex).carryindex; 13 | else 14 | carrynode = currnode; 15 | carryindex = poolindex; 16 | end 17 | 18 | scp.branchinput(branchindex).poolindex = poolindex; 19 | scp.branchinput(branchindex).carrynode = carrynode; 20 | scp.branchinput(branchindex).carryindex = carryindex; 21 | scp.branchinput(branchindex).readnumber = readnumber; 22 | scp.branchinput(branchindex).Index = ... 23 | [pipepool.(currnode)(poolindex).ReadPoint pipepool.(currnode)(poolindex).ReadPoint + readnumber - 1]; 24 | % scp.readnumber(poolindex) = readnumber; 25 | 26 | end -------------------------------------------------------------------------------- /recon/pipelinelib/poolclear.m: -------------------------------------------------------------------------------- 1 | function currpool = poolclear(currpool, poolfields) 2 | % to clear the pool 3 | % currpool = poolclear(currpool); 4 | % or 5 | % currpool = poolclear(currpool, poolfields); 6 | 7 | if nargin < 2 || isempty(poolfields) 8 | poolfields = fieldnames(currpool); 9 | end 10 | 11 | for ii = 1:length(poolfields) 12 | if isfield(currpool, poolfields{ii}) 13 | if isstruct(currpool.(poolfields{ii})) 14 | if size(currpool.(poolfields{ii}), 2) == 1 15 | % to recurse 16 | currpool.(poolfields{ii}) = poolclear(currpool.(poolfields{ii})); 17 | else 18 | % empty structure 19 | currpool.(poolfields{ii}) = struct([]); 20 | end 21 | else 22 | % empty 23 | currpool.(poolfields{ii}) = cast([], 'like', currpool.(poolfields{ii})); 24 | end 25 | end 26 | end 27 | 28 | end -------------------------------------------------------------------------------- /recon/pipelinelib/poolindex.m: -------------------------------------------------------------------------------- 1 | function r = poolindex(currpool, index) 2 | % to return the index in a pool 3 | 4 | r = index(1) : index(2); 5 | 6 | if currpool.circulatemode 7 | r = mod(r - 1, currpool.poolsize) + 1; 8 | end 9 | 10 | 11 | end -------------------------------------------------------------------------------- /recon/pipelinelib/poolmirror.m: -------------------------------------------------------------------------------- 1 | function mirrorpool = poolmirror(currpool, mirrorpool) 2 | % copy the fields of a pool expect the data 3 | 4 | if nargin < 2 5 | mirrorpool = struct(); 6 | end 7 | 8 | poolfields = fieldnames(currpool); 9 | 10 | for ii = 1 : length(poolfields) 11 | switch poolfields{ii} 12 | case {'datafields', 'data', 'trace'} 13 | % skip 14 | otherwise 15 | mirrorpool.(poolfields{ii}) = currpool.(poolfields{ii}); 16 | end 17 | 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /recon/pipelinelib/we shall move the pool things to a class.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/recon/pipelinelib/we shall move the pool things to a class.txt -------------------------------------------------------------------------------- /recon/prepare/reconnode_axial3dbackprojectionprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_axial3dbackprojectionprepare(dataflow, prmflow, status) 2 | % prepare node, just the reconnode_backprojectionprepare 3 | % [dataflow, prmflow, status] = reconnode_axial3dbackprojectionprepare(dataflow, prmflow, status); 4 | 5 | % Copyright Dier Zhang 6 | % 7 | % Licensed under the Apache License, Version 2.0 (the "License"); 8 | % you may not use this file except in compliance with the License. 9 | % You may obtain a copy of the License at 10 | % 11 | % http://www.apache.org/licenses/LICENSE-2.0 12 | % 13 | % Unless required by applicable law or agreed to in writing, software 14 | % distributed under the License is distributed on an "AS IS" BASIS, 15 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | % See the License for the specific language governing permissions and 17 | % limitations under the License. 18 | 19 | if ~isfield(prmflow.recon, 'method') || isempty(prmflow.recon.method) 20 | prmflow.recon.method = 'axial3d'; 21 | end 22 | [dataflow, prmflow, status] = reconnode_backprojectionprepare(dataflow, prmflow, status); 23 | 24 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_axialrebinprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_axialrebinprepare(dataflow, prmflow, status) 2 | % prepare node, axial-2D rebin prepare 3 | % [dataflow, prmflow, status] = reconnode_axialrebinprepare(dataflow, prmflow, status); 4 | 5 | % Copyright Dier Zhang 6 | % 7 | % Licensed under the Apache License, Version 2.0 (the "License"); 8 | % you may not use this file except in compliance with the License. 9 | % You may obtain a copy of the License at 10 | % 11 | % http://www.apache.org/licenses/LICENSE-2.0 12 | % 13 | % Unless required by applicable law or agreed to in writing, software 14 | % distributed under the License is distributed on an "AS IS" BASIS, 15 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | % See the License for the specific language governing permissions and 17 | % limitations under the License. 18 | 19 | % sure? 20 | prmflow.raw.scan = 'axial'; 21 | 22 | % no slope 23 | nodename = status.nodename; 24 | prmflow.pipe.(nodename).sloperebin = false; 25 | 26 | % rebin prepare 27 | [dataflow, prmflow, status] = reconnode_rebinprepare(dataflow, prmflow, status); 28 | 29 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_databufferprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_databufferprepare(dataflow, prmflow, status) 2 | % prepare node, data buffer prepare 3 | % [dataflow, prmflow, status] = reconnode_databufferprepare(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | nodename = status.nodename; 7 | if isfield(prmflow.pipe, nodename) 8 | nodeprm = prmflow.pipe.(nodename); 9 | else 10 | nodeprm = struct(); 11 | end 12 | 13 | % pipeline_onoff 14 | if isfield(nodeprm, 'pipeline_onoff') 15 | pipeline_onoff = status.pipeline_onoff & nodeprm.pipeline_onoff; 16 | else 17 | pipeline_onoff = status.pipeline_onoff; 18 | end 19 | 20 | % input pool 21 | if pipeline_onoff 22 | dataflow.pipepool.(nodename) = status.defaultpool; 23 | % We shall allow user to define the input pool fields 24 | dataflow.buffer.(nodename) = struct(); 25 | end 26 | 27 | status.jobdone = true; 28 | status.errorcode = 0; 29 | status.errormsg = []; 30 | 31 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_donothingprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_donothingprepare(dataflow, prmflow, status) 2 | % prepare node, prepare to do nothing 3 | % [dataflow, prmflow, status] = reconnode_donothingprepare(dataflow, prmflow, status); 4 | 5 | % wow~ 6 | % but nothing to prepare, -,- 7 | 8 | status.jobdone = true; 9 | status.errorcode = 0; 10 | status.errormsg = []; 11 | 12 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_helicalbackprojectionprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_helicalbackprojectionprepare(dataflow, prmflow, status) 2 | % prepare node, just the reconnode_backprojectionprepare 3 | % [dataflow, prmflow, status] = reconnode_helicalbackprojectionprepare(dataflow, prmflow, status); 4 | 5 | % Copyright Dier Zhang 6 | % 7 | % Licensed under the Apache License, Version 2.0 (the "License"); 8 | % you may not use this file except in compliance with the License. 9 | % You may obtain a copy of the License at 10 | % 11 | % http://www.apache.org/licenses/LICENSE-2.0 12 | % 13 | % Unless required by applicable law or agreed to in writing, software 14 | % distributed under the License is distributed on an "AS IS" BASIS, 15 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | % See the License for the specific language governing permissions and 17 | % limitations under the License. 18 | 19 | if ~isfield(prmflow.recon, 'method') || isempty(prmflow.recon.method) 20 | prmflow.recon.method = 'helical'; 21 | end 22 | [dataflow, prmflow, status] = reconnode_backprojectionprepare(dataflow, prmflow, status); 23 | 24 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_helicalrebinprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_helicalrebinprepare(dataflow, prmflow, status) 2 | % recon node, rebin prepare 3 | % [dataflow, prmflow, status] = reconnode_helicalrebinprepare(dataflow, prmflow, status); 4 | 5 | % Copyright Dier Zhang 6 | % 7 | % Licensed under the Apache License, Version 2.0 (the "License"); 8 | % you may not use this file except in compliance with the License. 9 | % You may obtain a copy of the License at 10 | % 11 | % http://www.apache.org/licenses/LICENSE-2.0 12 | % 13 | % Unless required by applicable law or agreed to in writing, software 14 | % distributed under the License is distributed on an "AS IS" BASIS, 15 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | % See the License for the specific language governing permissions and 17 | % limitations under the License. 18 | 19 | % sure? 20 | prmflow.raw.scan = 'helical'; 21 | 22 | % rebin prepare 23 | [dataflow, prmflow, status] = reconnode_rebinprepare(dataflow, prmflow, status); 24 | 25 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_log2prepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_log2prepare(dataflow, prmflow, status) 2 | % prepare node, prepare of log2 3 | % [dataflow, prmflow, status] = reconnode_log2prepare(dataflow, prmflow, status); 4 | % This is a sample of nothing to prepare, leave me alone plz. 5 | 6 | % nothing to prepre 7 | [dataflow, prmflow, status] = reconnode_donothingprepare(dataflow, prmflow, status); 8 | 9 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_multiaxialmeanprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_multiaxialmeanprepare(dataflow, prmflow, status) 2 | % prepare of mean multi-rotation of rawdata 3 | % [dataflow, prmflow, status] = reconnode_multiaxialmeanprepare(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | nodeprm = prmflow.pipe.(status.nodename); 7 | 8 | % if to mean all the shots 9 | if isfield(nodeprm, 'meanshots') 10 | meanshots = nodeprm.meanshots; 11 | else 12 | meanshots = false; 13 | end 14 | 15 | % parameters to use in prmflow 16 | if meanshots 17 | Nshot = 1; 18 | else 19 | Nshot = prmflow.raw.Nshot; 20 | end 21 | Nview = prmflow.raw.Nview; 22 | Nviewprot = prmflow.raw.Nviewprot; 23 | prmflow.raw.Nmulti = Nview/Nviewprot; 24 | 25 | % prmflow.raw after mean ?? 26 | prmflow.raw.Nview = Nviewprot * Nshot; 27 | prmflow.raw.Nshot = Nshot; 28 | prmflow.raw.viewpershot = Nviewprot; 29 | prmflow.raw.viewnumber = prmflow.raw.viewnumber/prmflow.raw.Nmulti; 30 | 31 | % status 32 | status.jobdone = true; 33 | status.errorcode = 0; 34 | status.errormsg = []; 35 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_pipelinestuckprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_pipelinestuckprepare(dataflow, prmflow, status) 2 | % prepare node, pipeline stuck prepare 3 | % [dataflow, prmflow, status] = reconnode_pipelinestuckprepare(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | nodename = status.nodename; 7 | if isfield(prmflow.pipe, nodename) 8 | nodeprm = prmflow.pipe.(nodename); 9 | else 10 | nodeprm = struct(); 11 | end 12 | 13 | % pipeline stuck is a hard coded reconnode_databuffer 14 | if ~isfield(nodeprm, 'alldata') && ~isfield(nodeprm, 'bufferfields') 15 | prmflow.pipe.(nodename).alldata = true; 16 | end 17 | % force 18 | prmflow.pipe.(nodename).copytodataflow = true; 19 | prmflow.pipe.(nodename).stuck = true; 20 | 21 | % pipeline_onoff 22 | pipeline_onoff = status.pipeline.(nodename).pipeline_onoff; 23 | 24 | % input pool 25 | if pipeline_onoff 26 | % initial inner buffer 27 | dataflow.buffer.(nodename) = struct(); 28 | end 29 | 30 | status.jobdone = true; 31 | status.errorcode = 0; 32 | status.errormsg = []; 33 | 34 | end -------------------------------------------------------------------------------- /recon/prepare/reconnode_upsampleprepare.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_upsampleprepare(dataflow, prmflow, status) 2 | % prepare node, X-upsample prepare 3 | % [dataflow, prmflow, status] = reconnode_upsampleprepare(dataflow, prmflow, status); 4 | 5 | % Copyright Dier Zhang 6 | % 7 | % Licensed under the Apache License, Version 2.0 (the "License"); 8 | % you may not use this file except in compliance with the License. 9 | % You may obtain a copy of the License at 10 | % 11 | % http://www.apache.org/licenses/LICENSE-2.0 12 | % 13 | % Unless required by applicable law or agreed to in writing, software 14 | % distributed under the License is distributed on an "AS IS" BASIS, 15 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | % See the License for the specific language governing permissions and 17 | % limitations under the License. 18 | 19 | % TBC 20 | 21 | prmflow.recon.upsampled = true; 22 | 23 | prmflow.recon.Npixel_up = prmflow.rebin.Nreb*2; 24 | prmflow.recon.delta_d_up = prmflow.rebin.delta_d/2; 25 | prmflow.recon.midchannel_up = round(prmflow.rebin.midU_phi*4-2)/2; 26 | 27 | % status 28 | status.jobdone = true; 29 | status.errorcode = 0; 30 | status.errormsg = []; 31 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_Systemconfigure.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_Systemconfigure(dataflow, prmflow, status) 2 | % support node, call system configure from CTsimulation 3 | % [dataflow, prmflow, status] = reconnode_Systemconfigure(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | sysprm = prmflow.pipe.(status.nodename); 7 | if isfield(sysprm, 'cfgfile') 8 | syscfgfile = sysprm.cfgfile; 9 | else 10 | % do nothing 11 | return; 12 | end 13 | 14 | % system configure 15 | configure.system = readcfgfile(syscfgfile); 16 | configure = configureclean(configure); 17 | SYS = systemconfigure(configure.system); 18 | SYS = systemprepare(SYS); 19 | 20 | % load protocol 21 | SYS.protocol = protocolconfigure(protocolrecon2simu(prmflow.protocol)); 22 | SYS = loadprotocol(SYS); 23 | 24 | % return 25 | prmflow.SYS = SYS; 26 | 27 | % status 28 | status.jobdone = true; 29 | status.errorcode = 0; 30 | status.errormsg = []; 31 | end 32 | 33 | 34 | function protocol = protocolrecon2simu(protocol) 35 | % different defination of the tags between recon/simu protocal 36 | 37 | % focal sopt 38 | focalspot_0x = focalspot20x(protocol.focalspot); 39 | protocol.focalspot = find(fliplr(dec2bin(focalspot_0x)=='1')); 40 | 41 | % no others? 42 | 43 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_corrclear.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_corrclear(dataflow, prmflow, status) 2 | % support node, clear corr tables 3 | % [dataflow, prmflow, status] = reconnode_corrclear(dataflow, prmflow, status); 4 | 5 | prmflow.corrtable = struct(); 6 | 7 | % status 8 | status.jobdone = true; 9 | status.errorcode = 0; 10 | status.errormsg = []; 11 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_dataclear.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_dataclear(dataflow, prmflow, status) 2 | % support node, clear 3 | % [dataflow, prmflow, status] = reconnode_dataclear(dataflow, prmflow, status); 4 | 5 | dataflow = struct(); 6 | prmflow = struct(); 7 | status = struct(); 8 | 9 | % status 10 | status.jobdone = true; 11 | status.errorcode = 0; 12 | status.errormsg = []; 13 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_datadelete.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_datadelete(dataflow, prmflow, status) 2 | % virus node, delete data 3 | % [dataflow, prmflow, status] = reconnode_databackup(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | backupprm = prmflow.pipe.(status.nodename); 7 | 8 | % dataflow, prmflow and status 9 | if isfield(backupprm, 'dataflow') 10 | dataflow = deletedata(dataflow, backupprm.dataflow); 11 | end 12 | if isfield(backupprm, 'prmflow') 13 | prmflow = deletedata(prmflow, backupprm.prmflow); 14 | end 15 | if isfield(backupprm, 'status') 16 | status = deletedata(status, backupprm.status); 17 | end 18 | 19 | % status 20 | status.jobdone = true; 21 | status.errorcode = 0; 22 | status.errormsg = []; 23 | end 24 | 25 | 26 | function data = deletedata(data, delfields) 27 | % copy data.bkfields to data.bkfields_bk 28 | 29 | if strcmpi(delfields, 'all') || isempty(delfields) 30 | data = struct(); 31 | return; 32 | end 33 | 34 | % delfields string to cell 35 | if ~iscell(delfields) 36 | delfields = regexp(regexprep(delfields, ' ', ''), ',', 'split'); 37 | end 38 | % isfield? 39 | delfields = delfields(isfield(data, delfields)); 40 | % delete the fields 41 | data = rmfield(data, delfields); 42 | 43 | end 44 | -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_datamean.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_datamean(dataflow, prmflow, status) 2 | % support node, mean of rawdata 3 | % [dataflow, prmflow, status] = reconnode_datamean(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | meanprm = prmflow.pipe.(status.nodename); 7 | 8 | % skipviews 9 | if isfield(meanprm, 'viewskip') && ~isempty(meanprm.viewskip) 10 | viewskip = meanprm.viewskip; 11 | else 12 | viewskip = 0; 13 | end 14 | 15 | % mean 16 | rawsize = size(dataflow.rawdata); 17 | dataflow.rawdata = reshape(dataflow.rawdata, [], rawsize(end)); 18 | dataflow.rawdata = mean(dataflow.rawdata(:, viewskip+1:end), 2); 19 | 20 | % status 21 | status.jobdone = true; 22 | status.errorcode = 0; 23 | status.errormsg = []; 24 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_disguiser.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_disguiser(dataflow, prmflow, status) 2 | % virus node, I am your mirror 3 | % [dataflow, prmflow, status] = reconnode_disguiser(dataflow, prmflow, status); 4 | % WARN: uncontrollable 5 | 6 | % parameters set in pipe 7 | disgprm = prmflow.pipe.(status.nodename); 8 | 9 | % I know the status.nodename is 'disguiser' or 'disguiser_*' 10 | if isfield(disgprm, 'node') && ~isempty(disgprm.node) 11 | myfun = str2func(['reconnode_' disgprm.node]); 12 | [dataflow, prmflow, status] = myfun(dataflow, prmflow, status); 13 | else 14 | % do nothing 15 | % status 16 | status.jobdone = true; 17 | status.errorcode = 0; 18 | status.errormsg = []; 19 | end 20 | 21 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_donothing.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_donothing(dataflow, prmflow, status) 2 | % support node, do nothing 3 | % [dataflow, prmflow, status] = reconnode_donothing(dataflow, prmflow, status); 4 | % It is the most important node on pipeline ;) which is a template of the pipeline nodes. 5 | 6 | % parameters set in pipe 7 | nodename = status.nodename; 8 | 9 | % pipeline_onoff 10 | pipeline_onoff = status.pipeline.(nodename).pipeline_onoff; 11 | 12 | % prio step 13 | if pipeline_onoff 14 | % do nothing is not trivial in pipeline (it is) 15 | 16 | % node prio-step 17 | [dataflow, prmflow, status] = nodepriostep(dataflow, prmflow, status); 18 | 19 | if status.currentjob.topass 20 | % error or pass 21 | return; 22 | end 23 | else 24 | status.jobdone = true; 25 | end 26 | 27 | % node kernel function 28 | 1; 29 | % nothing 30 | 31 | % post step 32 | if pipeline_onoff 33 | [dataflow, prmflow, status] = nodepoststep(dataflow, prmflow, status); 34 | end 35 | 36 | status.errorcode = 0; 37 | status.errormsg = []; 38 | end 39 | -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_error.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_error(dataflow, prmflow, status) 2 | % support node, to active an error 3 | % [dataflow, prmflow, status] = reconnode_error(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | errorprm = prmflow.pipe.(status.nodename); 7 | 8 | status.jobdone = false; 9 | if isfield(errorprm, 'errorcode') 10 | status.errorcode = errorprm.errorcode; 11 | else 12 | status.errorcode = 1; 13 | end 14 | if isfield(errorprm, 'errormsg') 15 | status.errormsg = errorprm.errormsg; 16 | else 17 | status.errormsg = []; 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_flow2workspace.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_flow2workspace(dataflow, prmflow, status) 2 | % virus node, output dataflow, prmflow and status to workspace 3 | % [dataflow, prmflow, status] = reconnode_flow2workspace(dataflow, prmflow, status); 4 | 5 | 6 | % parameters set in pipe 7 | nodeprm = prmflow.pipe.(status.nodename); 8 | 9 | % backup index 10 | if isfield(nodeprm, 'index') 11 | flowindex = num2str(nodeprm.index); 12 | else 13 | flowindex = num2str(status.seriesindex); 14 | end 15 | 16 | if ~isempty(flowindex) 17 | flowindex = ['_' flowindex]; 18 | end 19 | 20 | % dataflow, prmflow and status 21 | assignin('base', ['dataflow' flowindex], dataflow); 22 | assignin('base', ['prmflow' flowindex], prmflow); 23 | assignin('base', ['status' flowindex], status); 24 | 25 | % status 26 | status.jobdone = true; 27 | status.errorcode = 0; 28 | status.errormsg = []; 29 | end 30 | -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_null.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_null(dataflow, prmflow, status) 2 | % support node, not exist null node 3 | % [dataflow, prmflow, status] = reconnode_null(dataflow, prmflow, status); 4 | 5 | error('A NULL node does not exist! It can not be configured or called by any way!'); 6 | 7 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_pipelinedatamove.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_pipelinedatamove(dataflow, prmflow, status) 2 | % recon node, move data between the rawdata and nodes' buffer 3 | % [dataflow, prmflow, status] = reconnode_pipelinedatamove(dataflow, prmflow, status); 4 | 5 | 6 | % TBC 7 | 8 | 9 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_pipelinestuck.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_pipelinestuck(dataflow, prmflow, status) 2 | % support node, to link a pipeline node with a non-pipeline node 3 | % [dataflow, prmflow, status] = reconnode_pipelinestuck(dataflow, prmflow, status); 4 | 5 | % pipeline stuck is a hard coded reconnode_databuffer, see reconnode_pipelinestuckprepare 6 | 7 | % call reconnode_databuffer 8 | [dataflow, prmflow, status] = reconnode_databuffer(dataflow, prmflow, status); 9 | 10 | end -------------------------------------------------------------------------------- /recon/supportnodes/reconnode_sleep.m: -------------------------------------------------------------------------------- 1 | function [dataflow, prmflow, status] = reconnode_sleep(dataflow, prmflow, status) 2 | % support node, sleep 3 | % [dataflow, prmflow, status] = reconnode_sleep(dataflow, prmflow, status); 4 | 5 | % parameters set in pipe 6 | sleepprm = prmflow.pipe.(status.nodename); 7 | 8 | if isfield(sleepprm, 'time') 9 | pause(); 10 | else 11 | pause(sleepprm.time); 12 | end 13 | 14 | % status 15 | status.jobdone = true; 16 | status.errorcode = 0; 17 | status.errormsg = []; 18 | end -------------------------------------------------------------------------------- /scripts/BoneBHCorrectionScript_3Dfit.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/scripts/BoneBHCorrectionScript_3Dfit.m -------------------------------------------------------------------------------- /scripts/BoneBHCorrectionScript_surffit.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/scripts/BoneBHCorrectionScript_surffit.m -------------------------------------------------------------------------------- /scripts/_to release informal workflows in here: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/scripts/_to release informal workflows in here -------------------------------------------------------------------------------- /scripts/airrepeat_script.m: -------------------------------------------------------------------------------- 1 | datapath = '\\192.168.1.36\pangu.dat\RAW\smallbowtie'; 2 | 3 | fdir = dir(fullfile(datapath, '**\*.pd')); 4 | Nf = size(fdir(:) ,1); 5 | % Nf = 2; 6 | 7 | % angle sections 8 | Nsection = 12; 9 | delta = pi*2/Nsection; 10 | sectangle = (0:Nsection).*delta; 11 | 12 | rawdata = cell(Nf, 1); 13 | for ii = 1:Nf 14 | fprintf('.'); 15 | dataflow = CRIS2dataflow(fullfile(fdir(ii).folder, fdir(ii).name)); 16 | % viewangle 17 | viewangle = dataflow.rawhead.viewangle; 18 | viewangle = mod(viewangle + delta/2, pi*2); 19 | % ini rawdata 20 | rawdata{ii} = zeros(size(dataflow.rawdata, 1), Nsection); 21 | for isect = 1:Nsection 22 | viewindex = (viewangle>=sectangle(isect)) & (viewangle 2 | 3 | E:\matlab\CT\SINO\TM\system_configure_TM_BoneBH_cali.xml 4 | .\system\mod\phantom\phantom_Head_Cranium_170_center.xml 5 | E:\matlab\CT\SINO\TM\protocol_Bonebeamharden.xml 6 | 7 | -------------------------------------------------------------------------------- /system/mod/bowtieframe/bowtie_sample_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/bowtieframe/bowtie_sample_v1.0.corr -------------------------------------------------------------------------------- /system/mod/bowtieframe/bowtiecurvesample.m: -------------------------------------------------------------------------------- 1 | function bowtiecurve = bowtiecurvesample(minthick, maxthick, length, shoulderwidth, shoulderslope) 2 | % a sample to design a bowtie curve 3 | % bowtiecurve = bowtiecurvesample(maxthick, minthick, length, 4 | % shoulderwidth, shoulderslope); 5 | % Don't known how to design a bowtie? try this 6 | 7 | xx = 0:0.1:length/2; 8 | xx = [-fliplr(xx(2:end)) xx]; 9 | 10 | x1 = log(exp(abs(xx)./shoulderwidth)-1).*shoulderwidth; 11 | yy = (maxthick-minthick)./(1+exp((shoulderwidth-x1).*shoulderslope)) + minthick; 12 | 13 | xx = xx+length/2; 14 | bowtiecurve = [xx(:) yy(:)]; -------------------------------------------------------------------------------- /system/mod/bowtieframe/bowtiesample.m: -------------------------------------------------------------------------------- 1 | function bowtie_corr = bowtiesample(corrfile) 2 | % bowtie corr sample 3 | % WARN: DO NOT COPY THIS CURVE TO REAL PRODUCT 4 | 5 | if nargin<1 6 | corrfile = './bowtie_sample_v1.0.corr'; 7 | end 8 | 9 | % smample curves 10 | minthick = 2; 11 | maxthick = 50; 12 | length = 180; 13 | curve1 = bowtiecurvesample(minthick, maxthick, length, 12.5, 0.18); 14 | curve2 = bowtiecurvesample(minthick, maxthick, length, 16.5, 0.14); 15 | 16 | % corr struct 17 | bowtie_corr.ID = uint8([0 0 0 0]); 18 | bowtie_corr.box = single([length, 20, 50]); 19 | bowtie_corr.focaltobottom = single(150); 20 | bowtie_corr.Ncurve = uint32(2); 21 | bowtie_corr.Nsample = uint32(size(curve1, 1)); 22 | bowtie_corr.main = single([curve1 curve2(:,2)]); 23 | 24 | % save corr 25 | if ~isempty(corrfile) 26 | corrcfg = readcfgfile(cfgmatchrule(corrfile)); 27 | packstruct(bowtie_corr, corrcfg, corrfile); 28 | end 29 | 30 | end 31 | 32 | -------------------------------------------------------------------------------- /system/mod/console/sample_filenamerule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | namekey, scan, KV, mA, collimator, rotationspeed_%gSecpRot, focalsize, focalspot, bowtie 4 | KV, collimator, rotationspeed_%gSecpRot, focalsize, focalspot, bowtie 5 | KV, collimator, focalsize, focalspot, bowtie 6 | KV, collimator, focalsize, focalspot, bowtie 7 | KV, collimator, focalsize, focalspot, bowtie 8 | KV, collimator, focalsize, focalspot, bowtie 9 | KV, collimator, focalspot, bowtie 10 | KV, collimator, focalsize, focalspot, bowtie 11 | namekey, KV, collimator, focalsize, focalspot 12 | -------------------------------------------------------------------------------- /system/mod/console/sample_filenamerule2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | namekey, scan, KV, mA, collimator, rotationspeed_%0.2fsec, FOCALSIZE, focalspot, largebowtie 4 | KV, collimator, rotationspeed_%0.2fsec, FOCALSIZE, focalspot, largebowtie, CU_96 5 | collimator, CU 6 | KV, collimator, FOCALSIZE, focalspot, largebowtie, CU 7 | KV, collimator, FOCALSIZE, focalspot, largebowtie, CU 8 | KV, collimator, FOCALSIZE, focalspot, largebowtie, CU 9 | KV, collimator, FOCALSIZE, focalspot, largebowtie, CU 10 | KV, collimator, focalspot, largebowtie, CU 11 | KV, collimator, FOCALSIZE, focalspot, largebowtie, CU 12 | namekey, KV, collimator, FOCALSIZE, focalspot, CU 13 | -------------------------------------------------------------------------------- /system/mod/detectorframe/detector_sample_unit16.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/detectorframe/detector_sample_unit16.corr -------------------------------------------------------------------------------- /system/mod/detectorframe/detector_sample_unit24.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/detectorframe/detector_sample_unit24.corr -------------------------------------------------------------------------------- /system/mod/detectorframe/detector_sample_unit64_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/detectorframe/detector_sample_unit64_v1.0.corr -------------------------------------------------------------------------------- /system/mod/detectorframe/detector_sample_v1.0.corr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/detectorframe/detector_sample_v1.0.corr -------------------------------------------------------------------------------- /system/mod/detectorframe/detectorframe.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/detectorframe/detectorframe.rar -------------------------------------------------------------------------------- /system/mod/detectorframe/detectorpos_ideal_1000.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/detectorframe/detectorpos_ideal_1000.mat -------------------------------------------------------------------------------- /system/mod/phantom/phantom_Cublade1mm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Blade 8 | 0 0 0 9 | 300 0 0 10 | 0 0 -300 11 | 0 1 0 12 | metalCu 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_Head_Cranium_170_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 85 0 0 10 | 0 85 0 11 | 0 0 75 12 | Cranium 13 | 14 | 15 | Cylinder 16 | 0 0 0 17 | 79 0 0 18 | 0 79 0 19 | 0 0 75 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_Head_Cranium_170_center_10mm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 85 0 0 10 | 0 85 0 11 | 0 0 75 12 | Cranium 13 | 14 | 15 | Cylinder 16 | 0 0 0 17 | 75 0 0 18 | 0 75 0 19 | 0 0 75 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_Head_Cranium_170_center_4mm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 85 0 0 10 | 0 85 0 11 | 0 0 75 12 | Cranium 13 | 14 | 15 | Cylinder 16 | 0 0 0 17 | 81 0 0 18 | 0 81 0 19 | 0 0 75 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_Head_Cranium_170_center_8mm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 85 0 0 10 | 0 85 0 11 | 0 0 75 12 | Cranium 13 | 14 | 15 | Cylinder 16 | 0 0 0 17 | 77 0 0 18 | 0 77 0 19 | 0 0 75 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_air.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 0 6 | 7 | 8 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_heart_of_oak.json: -------------------------------------------------------------------------------- 1 | { 2 | "phantom_cfg": { 3 | "Nobject": 3, 4 | "object_root": 0, 5 | "object_tree": [0, 1, 1], 6 | "object": [{ 7 | "type": "Cylinder", 8 | "O": [0, 0, 25], 9 | "vector": [[100, 0, 0], [0, 100, 0], [0, 0, 30]], 10 | "material": "PMMA", 11 | "normalnd": "" 12 | }, { 13 | "type": "Sphere", 14 | "O": [-7, 0, 25], 15 | "vector": [[43.3, 25, 0], [-15, 25.98, 0], [0, 0, 30]], 16 | "material": "water", 17 | "crossplane": [1, 0, 0, 0] 18 | }, { 19 | "type": "Sphere", 20 | "O": [7, 0, 25], 21 | "vector": [[43.3, -25, 0], [15, 25.98, 0], [0, 0, 30]], 22 | "material": "water", 23 | "crossplane": [-1, 0, 0, 0] 24 | }] 25 | } 26 | } -------------------------------------------------------------------------------- /system/mod/phantom/phantom_heart_of_oak.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 0 5 | 0 1 1 6 | 7 | Cylinder 8 | 0 0 25 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | 16 | Sphere 17 | -7 0 25 18 | 43.30 25 0 19 | -15 25.98 0 20 | 0 0 30 21 | water 22 | 1 0 0 0 23 | 24 | 25 | Sphere 26 | 7 0 25 27 | 43.30 -25 0 28 | 15 25.98 0 29 | 0 0 30 30 | water 31 | -1 0 0 0 32 | 33 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_shellwater200_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | Cylinder 16 | 0 0 0 17 | 95 0 0 18 | 0 95 0 19 | 0 0 30 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_shellwater200_off120.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 120 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | Cylinder 16 | 0 120 0 17 | 95 0 0 18 | 0 95 0 19 | 0 0 30 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_shellwater200_off90.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 90 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | Cylinder 16 | 0 90 0 17 | 95 0 0 18 | 0 95 0 19 | 0 0 30 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_shellwater300_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 150 0 0 10 | 0 150 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | Cylinder 16 | 0 0 0 17 | 145 0 0 18 | 0 145 0 19 | 0 0 30 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_shellwater300_off120.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 120 0 9 | 150 0 0 10 | 0 150 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | Cylinder 16 | 0 120 0 17 | 145 0 0 18 | 0 145 0 19 | 0 0 30 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_shellwater300_off90.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 90 0 9 | 150 0 0 10 | 0 150 0 11 | 0 0 30 12 | PMMA 13 | 14 | 15 | Cylinder 16 | 0 90 0 17 | 145 0 0 18 | 0 145 0 19 | 0 0 30 20 | water 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_stealball.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2 4 | 0 5 | 0 1 6 | 7 | Cylinder 8 | 0 200 3 9 | 40 0 0 10 | 0 40 0 11 | 0 0 50 12 | foamedPE 13 | 14 | 15 | Sphere 16 | 0 200 3 17 | 2.5 0 0 18 | 0 2.5 0 19 | 0 0 2.5 20 | steel301 21 | 22 | 23 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_water200_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Cylinder 8 | 0 0 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | water 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_water200_off20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Cylinder 8 | 0 20 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | water 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_water200_off90.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Cylinder 8 | 0 90 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | water 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_water300_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Cylinder 8 | 0 0 0 9 | 150 0 0 10 | 0 150 0 11 | 0 0 30 12 | water 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/phantom/phantom_water300_off90.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Cylinder 8 | 0 90 0 9 | 150 0 0 10 | 0 150 0 11 | 0 0 30 12 | water 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/phantom_water.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 0 5 | 0 6 | 7 | Cylinder 8 | 0 0 0 9 | 100 0 0 10 | 0 100 0 11 | 0 0 30 12 | water 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/mod/protocol/sample_protocol_Axial.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | Axial 6 | 16x1.0 7 | Body 8 | 1 9 | 1 10 | 120 11 | 200 12 | 30 13 | 1440 14 | 1 15 | 1 16 | 17 | 0 18 | 0 19 | 1 20 | 8.8 21 | 0 22 | 0 23 | 24bit 24 | 25 | -------------------------------------------------------------------------------- /system/mod/protocol/sample_protocol_Helical.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | Helical 6 | 16x1.0 7 | Body 8 | 1 9 | 1 10 | 120 11 | 200 12 | 30 13 | 1440 14 | 1 15 | 3.5 16 | 17 | 0 18 | 0 19 | 1 20 | 0 21 | 0 22 | -15.84 23 | 24bit 24 | 25 | -------------------------------------------------------------------------------- /system/mod/rawdataframe/rawdata_sample.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/system/mod/rawdataframe/rawdata_sample.raw -------------------------------------------------------------------------------- /system/mod/recon/reconsystem_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | D:\matlab\CTsimulation\system\mod\detectorframe\detector_sample_unit24.corr 4 | 0 -550 0 5 | 69120 6 | 0 7 | 16384 8 | D:\matlab\CTsimulation\system\mod\detectorframe\collimatorexplain_unit24.xml 9 | D:\matlab\CTsimulation\system\mod\console\sample_filenamerule.xml 10 | D:\matlab\CTsimulation\system\mod\console\sample_corrcouplerule.xml 11 | .corr 12 | D:\matlab\Data\cali 13 | -------------------------------------------------------------------------------- /system/mod/sample_configure.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | .\system\mod\sample_system.xml 4 | .\system\mod\phantom\phantom_water200_off20.xml 5 | .\system\mod\sample_protocol.xml 6 | 7 | -------------------------------------------------------------------------------- /system/mod/sample_phantom.json: -------------------------------------------------------------------------------- 1 | { 2 | "Nobject": 3, 3 | "object_root": 0, 4 | "object_tree": [[0, 1, 1]], 5 | "object": [{ 6 | "type": "Cylinder", 7 | "O": [[0, 0, 0]], 8 | "vector": [[160, 10, 20], [0, 160, 0], [0, 0, 30]], 9 | "material": "Water" 10 | }, { 11 | "type": "Sphere", 12 | "O": [[120, 0, 0]], 13 | "vector": [[20, 0, 0], [0, 20, 0], [0, 0, 20]], 14 | "material": "Vacuum" 15 | }, { 16 | "type": "Sphere", 17 | "O": [[0, 80, 6]], 18 | "vector": [[40, 0, 0], [0, 40, 0], [0, 0, 20]], 19 | "material": "Water1100" 20 | }] 21 | } 22 | -------------------------------------------------------------------------------- /system/mod/sample_phantom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 0 5 | 0 1 1 6 | 7 | Cylinder 8 | 0 0 0 9 | 160 0 0 10 | 0 160 0 11 | 0 0 30 12 | Water 13 | 14 | 15 | Sphere 16 | 120 0 0 17 | 20 0 0 18 | 0 20 0 19 | 0 0 20 20 | Vacuum 21 | 22 | 23 | Sphere 24 | 0 80 6 25 | 40 0 0 26 | 0 40 0 27 | 0 0 20 28 | Water1100 29 | 30 | -------------------------------------------------------------------------------- /system/mod/sample_protocol.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | Axial 6 | 16x1.0 7 | Body 8 | 1 9 | 1 10 | 120 11 | 200 12 | 30 13 | 1440 14 | 1 15 | 1 16 | 17 | 0 18 | 0 19 | 1 20 | 8.8 21 | 0 22 | 0 23 | 24bit 24 | 25 | -------------------------------------------------------------------------------- /system/protocolcfgsample.m: -------------------------------------------------------------------------------- 1 | function PROTO = protocolcfgsample() 2 | % return a default simulation protocol config, just a sample 3 | 4 | % protocal 5 | PROTO.seriesnumber = 2; 6 | 7 | % series 8 | PROTO.series{1}.scan = 'Axial'; 9 | PROTO.series{1}.collimator = 'All'; 10 | PROTO.series{1}.bowtie = 'Body'; % Empty, Body, Head (0 , 1, 2) 11 | PROTO.series{1}.focalspot = 1; 12 | PROTO.series{1}.focalsize = 1; % 1: small, 2: big 13 | PROTO.series{1}.KV = 120; 14 | PROTO.series{1}.mA = 200; 15 | PROTO.series{1}.mA_air = 30; 16 | PROTO.series{1}.viewperrot = 1440; 17 | PROTO.series{1}.rotationspeed = 1.0; % sec per rotation 18 | PROTO.series{1}.rotationnumber = 1.0; 19 | PROTO.series{1}.viewnumber = []; 20 | PROTO.series{1}.startangle = 0; 21 | PROTO.series{1}.startcouch = 0; 22 | PROTO.series{1}.shotnumber = 1; 23 | PROTO.series{1}.shotcouchstep = 8.8; 24 | PROTO.series{1}.couchheight = 0; 25 | PROTO.series{1}.couchspeed = 0; 26 | PROTO.series{1}.rawdatastyle = '24bit'; 27 | 28 | PROTO.series{2}.startcouch = -8.8; 29 | PROTO.series{2}.bowtie = 'Empty'; 30 | PROTO.series{2}.shotnumber = 2; 31 | 32 | -------------------------------------------------------------------------------- /system/systemprepare.m: -------------------------------------------------------------------------------- 1 | function SYS = systemprepare(SYS) 2 | % prepare before the simulation 3 | 4 | % samplekeV 5 | if ~isfield(SYS.world, 'samplekeV') 6 | samplekeV = SYS.world.samplekeV_range(1) : SYS.world.samplekeV_step : SYS.world.samplekeV_range(2); 7 | SYS.world.samplekeV = samplekeV; 8 | else 9 | samplekeV = SYS.world.samplekeV; 10 | end 11 | 12 | % load matreials 13 | SYS = materialconfigure(SYS, samplekeV, SYS.world.elementsdata, SYS.world.materialdata); 14 | 15 | % to double 16 | SYS = everything2single(SYS, 'single', 'double'); 17 | 18 | end -------------------------------------------------------------------------------- /tools/classGPU.m: -------------------------------------------------------------------------------- 1 | function r = classGPU(x) 2 | % I can not remember what classUnderlying nor underlyingtype 3 | 4 | switch class(x) 5 | case 'gpuArray' 6 | r = classUnderlying(x); 7 | otherwise 8 | r = class(x); 9 | end -------------------------------------------------------------------------------- /tools/classsize.m: -------------------------------------------------------------------------------- 1 | function m = classsize(class) 2 | % get Bytes of a class 3 | 4 | switch class 5 | case {'double', 'int64', 'uint64'} 6 | m = 8; 7 | case {'single', 'int32', 'uint32'} 8 | m = 4; 9 | case {'int24', 'uint24'} 10 | m = 3; 11 | case {'int16', 'uint16'} 12 | m = 2; 13 | case {'int8', 'uint8', 'char', 'logical', 'bool'} 14 | m = 1; 15 | otherwise 16 | m = 0; 17 | end 18 | 19 | end -------------------------------------------------------------------------------- /tools/cleaninputarg.m: -------------------------------------------------------------------------------- 1 | function varargout = cleaninputarg(defaultval, varargin) 2 | % clean input arguments for functions 3 | % assume a function myfun(x, y, varargin) have default values of the varargin {a0, b0, c0}, call this 4 | % [a, b, c] = cleaninputarg({a0, b0, c0}, varargin{:}); 5 | % to fill up the empty and skipped input arguments 6 | % NOTE: here the input is the 'varargin{:}' but NOT the 'varargin'! Nor it will be confused in a cell argument or a 7 | % multi-argument input. 8 | 9 | if ~iscell(defaultval) 10 | defaultval = {defaultval}; 11 | end 12 | 13 | N = min(length(defaultval), nargin-1); 14 | s = ~cellfun(@isempty, varargin(1:N)); 15 | defaultval(s) = varargin(s); 16 | varargout = defaultval(1:nargout); 17 | 18 | end -------------------------------------------------------------------------------- /tools/cttool.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/tools/cttool.m -------------------------------------------------------------------------------- /tools/cttool/+cttool/cttool.m: -------------------------------------------------------------------------------- 1 | function hout = cttool(varargin) 2 | % entry 3 | 4 | hFig = imcttool(varargin{:}); 5 | if (nargout > 0) 6 | % Only return handle if caller requested it. 7 | hout = hFig; 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /tools/cttool/+cttool_2016/cttool.m: -------------------------------------------------------------------------------- 1 | function hout = cttool(varargin) 2 | % entry 3 | 4 | hFig = imcttool(varargin{:}); 5 | if (nargout > 0) 6 | % Only return handle if caller requested it. 7 | hout = hFig; 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /tools/cttool/images/leftarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/tools/cttool/images/leftarrow.png -------------------------------------------------------------------------------- /tools/cttool/images/rightarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dier3486/CT-simulation/59b8caefab024554a6d8f7a45a0f038306115747/tools/cttool/images/rightarrow.png -------------------------------------------------------------------------------- /tools/curves/acot2.m: -------------------------------------------------------------------------------- 1 | function y = acot2(x) 2 | % my acot 3 | % y = acot2(x) 4 | 5 | y = acot(x) + (1-sign(x)).*(pi/2); 6 | end -------------------------------------------------------------------------------- /tools/curves/mylorenzcurve.m: -------------------------------------------------------------------------------- 1 | function y = mylorenzcurve(x, alpha) 2 | % a Lorenz curve, hyperbolic 3 | % y = mylorenzcurve(x, alpha); 4 | % x in [0 1], alpha in [-1, 1]. 5 | 6 | % y = (1-alpha).*x./(1+alpha - x.*alpha.*2); 7 | y = (1-alpha).*x./(1-alpha + (1-x).*alpha.*2); -------------------------------------------------------------------------------- /tools/curves/slidecurve.m: -------------------------------------------------------------------------------- 1 | function y = slidecurve(ta, tb, sigma) 2 | % a slide curve 3 | % ta = x-a; tb = b-x; 4 | % 0 free 5 | 6 | t = fillmissing((ta-tb)./(ta+tb), 'constant', 0); 7 | y = (ta-tb)./2 + (ta+tb)./2.*sign(t).*sigma.*log((1+exp(1/sigma).*exp(-abs(t)./sigma))./(exp(1/sigma)+exp(-abs(t)./sigma))); 8 | 9 | end 10 | -------------------------------------------------------------------------------- /tools/everything2real.m: -------------------------------------------------------------------------------- 1 | function A = everything2real(A) 2 | % cast the A to real(A) 3 | % A = everything2real(A); 4 | 5 | classA = class(A); 6 | switch classA 7 | case 'struct' 8 | if length(A)>1 9 | for ii = 1:length(A(:)) 10 | A(ii) = everything2real(A(ii)); 11 | end 12 | else 13 | fields = fieldnames(A); 14 | for ifield = 1:length(fields) 15 | A.(fields{ifield}) = everything2real(A.(fields{ifield})); 16 | end 17 | end 18 | case 'cell' 19 | for icell = 1:length(A(:)) 20 | A{icell} = everything2real(A{icell}); 21 | end 22 | otherwise 23 | if ~isreal(A) 24 | A = real(A); 25 | end 26 | end 27 | 28 | end -------------------------------------------------------------------------------- /tools/fileposorgtoend.m: -------------------------------------------------------------------------------- 1 | function datasize = fileposorgtoend(fid) 2 | % datasize left in the file 3 | 4 | pforigin = ftell(fid); 5 | fseek(fid, 0, 'eof'); 6 | pfend = ftell(fid); 7 | fseek(fid, pforigin, 'bof'); 8 | 9 | datasize = pfend - pforigin; 10 | 11 | end -------------------------------------------------------------------------------- /tools/findfield.m: -------------------------------------------------------------------------------- 1 | function [val, address] = findfield(A, fieldname) 2 | % to find a field in struct A 3 | 4 | if isfield(A, fieldname) 5 | val = A(1).(fieldname); 6 | address = fieldname; 7 | else 8 | address = ''; 9 | val = []; 10 | fields = fieldnames(A); 11 | for ii = 1:length(fields) 12 | if isstruct(A.(fields{ii})) 13 | [val, address] = findfield(A(1).(fields{ii}), fieldname); 14 | if ~isempty(address) 15 | address = [fields{ii} '.' address]; 16 | break; 17 | end 18 | end 19 | end 20 | end 21 | 22 | end -------------------------------------------------------------------------------- /tools/findfields.m: -------------------------------------------------------------------------------- 1 | function fd = findfields(A, tofind) 2 | % to find the fields in A match with the regular expression tofind 3 | % fd = findfields(A, tofind); 4 | % e.g. when tofind='\0) & (index0 1 11 | strptr = 'cstring'; 12 | A.(fields{ii}) = libpointer(strptr, A.(fields{ii})); 13 | end 14 | case 'logical' 15 | if length(A.(fields{ii})(:)) > 1 16 | strptr = 'int8Ptr'; 17 | A.(fields{ii}) = libpointer(strptr, A.(fields{ii})); 18 | end 19 | otherwise 20 | if length(A.(fields{ii})(:)) > 1 21 | strptr = [fclass 'Ptr']; 22 | A.(fields{ii}) = libpointer(strptr, A.(fields{ii})); 23 | end 24 | end 25 | end 26 | 27 | end -------------------------------------------------------------------------------- /tools/structmerge.m: -------------------------------------------------------------------------------- 1 | function A = structmerge(A, B, flag_empty, flag_recurse) 2 | % merge struct B to A, but not overwriting the fields already existed in A 3 | % A = structmerge(A, B, flag_empty, flag_recurse); 4 | % FLAG: 5 | % flag_empty false: skip the empty fields in A (default) 6 | % true: overwrite the empty fields in A 7 | % flag_recurse false: no recurse 8 | % true: recurse the sub structs (default) 9 | 10 | if nargin<3 11 | flag_empty = false; 12 | end 13 | if nargin<4 14 | flag_recurse = true; 15 | end 16 | 17 | if isempty(A) 18 | A = struct(); 19 | end 20 | if isempty(B) 21 | B = struct(); 22 | end 23 | 24 | % Afields = fieldnames(A); 25 | Bfields = fieldnames(B); 26 | 27 | for ii = 1:length(Bfields) 28 | field_ii = Bfields{ii}; 29 | if ~isfield(A, field_ii) 30 | A.(field_ii) = B.(field_ii); 31 | elseif flag_empty && isempty(A.(field_ii)) 32 | A.(field_ii) = B.(field_ii); 33 | elseif isstruct(A.(field_ii)) && flag_recurse 34 | A.(field_ii) = structmerge(A.(field_ii), B.(field_ii), flag_empty, flag_recurse); 35 | end 36 | end -------------------------------------------------------------------------------- /tools/structregexprep.m: -------------------------------------------------------------------------------- 1 | function S = structregexprep(S, torep, repby, root) 2 | % replace the text in S matched with expression torep by repby 3 | 4 | if nargin<4 5 | root = S; 6 | end 7 | 8 | Sclass = class(S); 9 | sizeS = size(S(:), 1); 10 | switch Sclass 11 | case 'char' 12 | % replace string 13 | S = regexprep(S, torep, repby); 14 | case 'cell' 15 | % loop cell to recurse 16 | for ii = 1:sizeS 17 | S{ii} = structregexprep(S{ii}, torep, repby, root); 18 | end 19 | case 'struct' 20 | % loop struct to recurse 21 | if sizeS>1 22 | for ii = 1:sizeS 23 | S(ii) = structregexprep(S(ii), torep, repby, root); 24 | end 25 | else 26 | fields = fieldnames(S); 27 | for ifield = 1:length(fields) 28 | S.(fields{ifield}) = structregexprep(S.(fields{ifield}), torep, repby, root); 29 | end 30 | end 31 | otherwise 32 | % do nothing 33 | 1; 34 | end -------------------------------------------------------------------------------- /tools/structstrreplace.m: -------------------------------------------------------------------------------- 1 | function S = structstrreplace(S, torep, repby) 2 | % replace string torep by repby 3 | 4 | Sclass = class(S); 5 | sizeS = size(S(:), 1); 6 | switch Sclass 7 | case 'char' 8 | % replace string 9 | S = strrep(S, torep, repby); 10 | case 'cell' 11 | % loop cell to recurse 12 | for ii = 1:sizeS 13 | S{ii} = structstrreplace(S{ii}, torep, repby); 14 | end 15 | case 'struct' 16 | % loop struct to recurse 17 | if sizeS>1 18 | for ii = 1:sizeS 19 | S(ii) = structstrreplace(S(ii), torep, repby); 20 | end 21 | else 22 | fields = fieldnames(S); 23 | for ifield = 1:length(fields) 24 | S.(fields{ifield}) = structstrreplace(S.(fields{ifield}), torep, repby); 25 | end 26 | end 27 | otherwise 28 | % do nothing 29 | 1; 30 | end -------------------------------------------------------------------------------- /tools/tac.m: -------------------------------------------------------------------------------- 1 | function varargout = tac(A, dims) 2 | % inverse cat 3 | % varargout = tac(A, dims); 4 | % or varargout = tac(A); 5 | % e.g. [a b c] = tac([1 2 3]); to return a=1 b=2 c=3. 6 | % the 'dims' is just like what input in num2cell. 7 | % [a1 a2] = tac(A, [1 2]); to return a1=A(:,:,1), a2=A(:,:,2); 8 | 9 | if nargin>1 10 | Ac = num2cell(A, dims); 11 | else 12 | Ac = num2cell(A); 13 | end 14 | Ac = Ac(:); 15 | 16 | if nargout > length(Ac) 17 | Ac{nargout} = []; 18 | end 19 | 20 | varargout = Ac; 21 | 22 | end 23 | -------------------------------------------------------------------------------- /tools/whatisfft.m: -------------------------------------------------------------------------------- 1 | function [y, f] = whatisfft(dx, lubond, fun, varargin) 2 | % A sample of how to use fft. Anyone puzzled by fft could get help from this ;) 3 | % [y, f] = whatisfft(dx, lubond, fun, vargin); 4 | % e.g. [y, f] = whatisfft(0.1, [-10 10], @(x, a, b) exp(-(x-b).^2./(2*a^2))./(sqrt(2*pi)*a) , 1.1, 2); to get the fft 5 | % transformation of a normal distribution curve. 6 | % And plot(f, abs(y)) to show the curve, where the f is in Hz, 7 | % and note \omiga=2\pi*f, g(\omiga)=\int{f(t)e^{-i\omiga t}dt}. 8 | 9 | % xx 10 | xx = lubond(1):dx:lubond(2); 11 | Nx = length(xx); 12 | N = 2^ceil(log2(Nx)); 13 | % fx = fun(xx) 14 | if isa(fun, 'function_handle') 15 | fx = fun(xx, varargin{:}); 16 | else 17 | fx = fun; 18 | end 19 | % fft 20 | y = fft(fx, N); 21 | % norm 22 | y = y(1:N/2+1).*dx; 23 | f = (0:(N/2))/N./dx; 24 | end --------------------------------------------------------------------------------