Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:49

0001 #!/usr/bin/env python
0002 #
0003 # Copyright (c) 2019 Opticks Team. All Rights Reserved.
0004 #
0005 # This file is part of Opticks
0006 # (see https://bitbucket.org/simoncblyth/opticks).
0007 #
0008 # Licensed under the Apache License, Version 2.0 (the "License"); 
0009 # you may not use this file except in compliance with the License.  
0010 # You may obtain a copy of the License at
0011 #
0012 #   http://www.apache.org/licenses/LICENSE-2.0
0013 #
0014 # Unless required by applicable law or agreed to in writing, software 
0015 # distributed under the License is distributed on an "AS IS" BASIS, 
0016 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0017 # See the License for the specific language governing permissions and 
0018 # limitations under the License.
0019 #
0020 
0021 """
0022 
0023 ::
0024 
0025     In [3]: t0
0026     Out[3]: 
0027     array([[      1.    ,       0.    ,       0.    , ...,       0.    ,       0.    ,       1.    ],
0028            [     -0.5432,       0.8396,       0.    , ..., -802110.    ,   -2110.    ,       1.    ],
0029            [     -0.5432,       0.8396,       0.    , ..., -799739.375 ,    5390.    ,       1.    ],
0030            ..., 
0031            [      0.8396,       0.5432,       0.    , ..., -799312.625 ,   -7260.    ,       1.    ],
0032            [      0.2096,       0.9778,       0.    , ..., -794607.8125,   -7260.    ,       1.    ],
0033            [     -0.5432,       0.8396,       0.    , ..., -802110.    ,  -12410.    ,       1.    ]], dtype=float32)
0034 
0035     In [4]: t0.shape
0036     Out[4]: (12230, 16)
0037 
0038     In [6]: print t0[3159].reshape(4,4)
0039     [[      0.5432      -0.8396       0.           0.    ]
0040      [      0.8396       0.5432       0.           0.    ]
0041      [      0.           0.           1.           0.    ]
0042      [ -18079.4531 -799699.4375   -7100.           1.    ]]
0043 
0044 
0045 imon:GMergedMesh blyth$ cd 0
0046 simon:0 blyth$ l
0047 total 39992
0048 -rw-r--r--  1 blyth  staff       96 Jun 14 16:21 aiidentity.npy
0049 -rw-r--r--  1 blyth  staff   293600 Jun 14 16:21 bbox.npy
0050 -rw-r--r--  1 blyth  staff  1739344 Jun 14 16:21 boundaries.npy
0051 -rw-r--r--  1 blyth  staff   195760 Jun 14 16:21 center_extent.npy
0052 -rw-r--r--  1 blyth  staff  2702480 Jun 14 16:21 colors.npy
0053 -rw-r--r--  1 blyth  staff   195760 Jun 14 16:21 identity.npy
0054 -rw-r--r--  1 blyth  staff   195760 Jun 14 16:21 iidentity.npy
0055 -rw-r--r--  1 blyth  staff  5217872 Jun 14 16:21 indices.npy
0056 -rw-r--r--  1 blyth  staff      144 Jun 14 16:21 itransforms.npy
0057 -rw-r--r--  1 blyth  staff    49000 Jun 14 16:21 meshes.npy
0058 -rw-r--r--  1 blyth  staff   195760 Jun 14 16:21 nodeinfo.npy
0059 -rw-r--r--  1 blyth  staff  1739344 Jun 14 16:21 nodes.npy
0060 -rw-r--r--  1 blyth  staff  2702480 Jun 14 16:21 normals.npy
0061 -rw-r--r--  1 blyth  staff  1739344 Jun 14 16:21 sensors.npy
0062 -rw-r--r--  1 blyth  staff   782800 Jun 14 16:21 transforms.npy
0063 -rw-r--r--  1 blyth  staff  2702480 Jun 14 16:21 vertices.npy
0064 simon:0 blyth$ 
0065 
0066 
0067 """
0068 import os, logging, numpy as np
0069 log = logging.getLogger(__name__)
0070 from opticks.ana.base import opticks_main, idp_
0071 
0072 
0073 if __name__ == '__main__':
0074      tr = np.load(idp_("GMergedMesh/0/transforms.npy"))
0075      bb = np.load(idp_("GMergedMesh/0/bbox.npy"))             # 
0076      ce = np.load(idp_("GMergedMesh/0/center_extent.npy"))    # (12230, 4)
0077      ms = np.load(idp_("GMergedMesh/0/meshes.npy"))           # mesh index (12230, 1)
0078      vv = np.load(idp_("GMergedMesh/0/vertices.npy"))         #  (225200, 3) ... global positions
0079      nn = np.load(idp_("GMergedMesh/0/nodes.npy"))            #  (434816, 1)    nn.min() = 3153   nn.max() = 12220   triface->nodeidx
0080      ni = np.load(idp_("GMergedMesh/0/nodeinfo.npy"))         #  (12230, 4)    ni[:,0].sum() = 434816   ni[:,1].sum() = 225200   nf/nv/nix/pix
0081 
0082 
0083 
0084 
0085 
0086 
0087 
0088