Returns the size of a volume or sinogram, based on the projection or volume geometry. :param geom: Geometry to calculate size from :type geometry: :class:`dict` :param dim: Optional axis index to return :type dim: :class:`int`
(geom, dim=None)
| 33 | |
| 34 | |
| 35 | def geom_size(geom, dim=None): |
| 36 | """Returns the size of a volume or sinogram, based on the projection or volume geometry. |
| 37 | |
| 38 | :param geom: Geometry to calculate size from |
| 39 | :type geometry: :class:`dict` |
| 40 | :param dim: Optional axis index to return |
| 41 | :type dim: :class:`int` |
| 42 | """ |
| 43 | |
| 44 | if 'GridSliceCount' in geom: |
| 45 | # 3D Volume geometry? |
| 46 | s = (geom['GridSliceCount'], geom[ |
| 47 | 'GridRowCount'], geom['GridColCount']) |
| 48 | elif 'GridColCount' in geom: |
| 49 | # 2D Volume geometry? |
| 50 | s = (geom['GridRowCount'], geom['GridColCount']) |
| 51 | elif geom['type'] == 'parallel' or geom['type'] == 'fanflat': |
| 52 | s = (len(geom['ProjectionAngles']), geom['DetectorCount']) |
| 53 | elif geom['type'] == 'parallel3d' or geom['type'] == 'cone': |
| 54 | s = (geom['DetectorRowCount'], len( |
| 55 | geom['ProjectionAngles']), geom['DetectorColCount']) |
| 56 | elif geom['type'] == 'fanflat_vec' or geom['type'] == 'parallel_vec': |
| 57 | s = (geom['Vectors'].shape[0], geom['DetectorCount']) |
| 58 | elif geom['type'] == 'parallel3d_vec' or geom['type'] == 'cone_vec' or geom['type'] == 'cyl_cone_vec': |
| 59 | s = (geom['DetectorRowCount'], geom[ |
| 60 | 'Vectors'].shape[0], geom['DetectorColCount']) |
| 61 | |
| 62 | if dim != None: |
| 63 | s = s[dim] |
| 64 | |
| 65 | return s |
| 66 | |
| 67 | class GPULink(object): |
| 68 | """Utility class for astra.data3d.link with a CUDA pointer |
nothing calls this directly
no outgoing calls
no test coverage detected