API Reference
注意(プライベート要素)
このモジュールには先頭にアンダースコアを含む「プライベート」なクラス/関数が存在します。既定ではそれらの詳細はドキュメントから除外されます。
パッケージ全体
ISD Readerパッケージ
ISDフォルダ内のDescription.xmlファイルを解析/対応するバイナリ画像データを 適切なdtype(uint8/16/32)でNumPy2次元配列としてアクセス可能とする
このパッケージには以下が含まれる
- IsdReader: ISDデータセットを読み込むためのメインエントリポイント、すなわちISDデータそのものを包括するオブジェクトクラス
- 各種エラー発生時の例外クラス
使用例
from isdreader import IsdReader isd = IsdReader(isd_path="/path/to/folder.isd") ch = isd.GetCh(1) dg = ch.GetDataGate(2) img = dg.GetImage("AP") arr = img.load_image()
ここでarrがNumPy2次元配列である
BinaryFileNotFound
Bases: Exception
ISDフォルダ内に指定されたバイナリファイルが見つからない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
55 56 57 58 59 | |
DescriptionNotFound
Bases: Exception
ISDフォルダ内にDescription.xmlが見つからない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
41 42 43 44 45 | |
InvalidChannel
Bases: Exception
指定されたチャンネルインデックスが無効な場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
13 14 15 16 17 | |
InvalidDataGate
Bases: Exception
指定されたデータゲートインデックスが無効な場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
20 21 22 23 24 | |
IsdNotFound
Bases: Exception
指定されたISDフォルダが存在しない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
34 35 36 37 38 | |
IsdReader
ISDフォルダ全体を現すルートクラス このクラスはISD取得データセット内の全チャンネル、DataGate、および画像アクセス のメインエントリポイントである すなわち、ISDデータ全体を包括するオブジェクトクラスとなる Attributes: path: 包括すべきISDフォルダへのパス description_path: Description.xmlファイルへのパス(ISD直下に固定) logger: このオブジェクト用のロガーインスタンス
Source code in .build\ja\isdreader\isd_root.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
GetCh(ch=None)
ChChunkインスタンスを取得、または全チャンネルをリストアップする Args: ch: None、或いは指定のChChunk番号 Returns: chがNoneの場合は利用可能なチャンネル番号のリストアップ、それ以外の場合は指定のChChunkまたはNone
Source code in .build\ja\isdreader\isd_root.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
GetImage(*, ch, gate, image_type, slice_no=1)
ImageChunkを直接取得するメソッド Args: ch: チャンネル番号(1オリジン) gate: DataGate番号(1オリジン) image_type: 画像タイプ(省略形、フルネーム) slice_no: スライス番号(1オリジン、デフォルト: 1) Returns: 指定された条件で見つかったImageChunkインスタンス、それ以外の場合はNone
Source code in .build\ja\isdreader\isd_root.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
__init__(*, isd_path, logger=None)
引数ISDフォルダからIsdReaderオブジェクトを初期化する Args: isd_path: ISDフォルダへのパス(文字列またはpathlib.Path)。 logger: オプションのロガーインスタンス。Noneの場合はデフォルトロガー Raises: TypeError: isd_pathが文字列またはPathでない場合 IsdNotFound: ISDフォルダが存在しない場合 DescriptionNotFound: ISDフォルダ内にDescription.xmlが見つからない場合
Source code in .build\ja\isdreader\isd_root.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
__repr__()
このIsdReaderの文字列による概要を返す Returns: サイズと利用可能なチャンネルを含む文字列
Source code in .build\ja\isdreader\isd_root.py
86 87 88 89 90 91 92 93 94 95 96 97 98 | |
主要モジュール
ChChunk
複数のDataGateを含有しうるチャンネルを表すクラス 本クラスは取得システム内の物理的な超音波チャンネルに対応する
Source code in .build\ja\isdreader\chunks.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
GetDataGate(data_gate=None)
DataGateChunkインスタンスを取得、または全DataGateをリストアップする Args: data_gate: Noneの場合はDataGate番号をリストアップする、それ以外の場合は対応するDataGateChunkを返す Returns: data_gateがNoneの場合はDataGate番号のリスト、それ以外の場合はDataGateChunkインスタンスまたはNone
Source code in .build\ja\isdreader\chunks.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
__init__(root_elem, ch_elem, isd_root, width, height)
ChChunkインスタンスを初期化する Args: root_elem: Description.xmlのルートXML要素 ch_elem: チャンネルXML要素 isd_root: ISDフォルダルートへのパス width: 画像の幅(ピクセル数) height: 画像の高さ(ピクセル数)
Source code in .build\ja\isdreader\chunks.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
__repr__()
このChChunkの文字列による概要を返す Returns: チャンネル番号、名前、およびDataGateを含む文字列表現
Source code in .build\ja\isdreader\chunks.py
401 402 403 404 405 406 407 | |
list_datagates()
利用可能な全DataGate番号をリストアップする Returns: DataGate番号のリスト(1オリジン)
Source code in .build\ja\isdreader\chunks.py
377 378 379 380 381 382 383 | |
DataGateChunk
チャンネル内のDataGateを表すクラス なおDataGateは複数のスライス画像を含有しうる
Source code in .build\ja\isdreader\chunks.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
GetImage(image_type, slice_no=1)
指定されたタイプとスライスのImageChunkインスタンスを返却する Args: image_type: 画像タイプ(省略形、もしくはフルネーム) slice_no: スライス番号(1オリジン、デフォルト: 1) Returns: 見つかった場合はImageChunkインスタンス、それ以外の場合はNone
Source code in .build\ja\isdreader\chunks.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
GetSlice(slice_no=None)
全スライスをリストアップする Args: slice_no: Noneの場合は全スライス番号のリストアップを行う、それ以外の場合はTypeErrorが発生 Returns: slice_noがNoneの場合はスライス番号のリスト Raises: TypeError: slice_noが指定された場合
Source code in .build\ja\isdreader\chunks.py
288 289 290 291 292 293 294 295 296 297 298 299 300 | |
ImageTypes()
利用可能な画像タイプを説明する文字列を返却する Returns: 画像タイプの省略形とフルネームのカンマ区切り文字列
Source code in .build\ja\isdreader\chunks.py
302 303 304 305 306 307 308 | |
__init__(root_elem, ch_elem, dg_elem, isd_root, ch_public, ch_name, width, height, sampling_freq_mhz)
DataGateChunkインスタンスを初期化する Args: root_elem: Description.xmlのルートXML要素 ch_elem: チャンネルXML要素 dg_elem: DataGate XML要素 isd_root: ISDフォルダルートへのパス ch_public: パブリックチャンネル番号(1オリジン) ch_name: チャンネルの名前 width: 画像の幅(ピクセル数) height: 画像の高さ(ピクセル数) sampling_freq_mhz: サンプリング周波数(MHz)
Source code in .build\ja\isdreader\chunks.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
__repr__()
このDataGateChunkの文字列による概要を返す Returns: id、名前、および利用可能な画像を含む文字列表現
Source code in .build\ja\isdreader\chunks.py
329 330 331 332 333 334 335 336 337 | |
list_images()
利用可能な全スライス番号(1オリジン)をリストアップする Returns: スライス番号のリスト
Source code in .build\ja\isdreader\chunks.py
274 275 276 277 278 279 280 281 282 283 284 285 286 | |
ImageChunk
DataGate内の単一画像データ(メタデータ含む)を包括するクラス 本クラスは全てのメタデータを保持しバイナリ画像データへのアクセスを提供する
Source code in .build\ja\isdreader\chunks.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
img_array
property
読み込まれた画像配列にアクセスする Returns: 読み込まれた2次元NumPy配列 Raises: MiscellaneousError: 画像がまだ読み込まれていない場合
__init__(root_elem, ch_elem, dg_elem, img_elem, isd_root, ch_public, dg_xml_id, type_abbr, type_elem)
本ImageChunkインスタンスを初期化する Args: root_elem: Description.xmlのルートXML要素 ch_elem: チャンネルXML要素 dg_elem: DataGate XML要素 img_elem: 画像XML要素 isd_root: ISDフォルダルートへのパス ch_public: パブリックチャンネル番号(1オリジン) dg_xml_id: DataGateのXML id属性 type_abbr: 画像タイプの省略形("PP"、"AP"等) type_elem: 特定の画像タイプのXML要素
Source code in .build\ja\isdreader\chunks.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
__repr__()
このImageChunkの文字列による概要を返す Returns: 注入された全プロパティを含む文字列表現
Source code in .build\ja\isdreader\chunks.py
181 182 183 184 185 186 187 188 189 190 191 192 193 | |
build_metadata_args()
ImageChunkプロパティからbinary_loaderに渡すパラメータを構築する Returns: バイナリ読み込み用の(width, height, data_size)のタプル
Source code in .build\ja\isdreader\chunks.py
123 124 125 126 127 128 129 130 131 132 | |
load_image(y_flipped=True)
バイナリ画像データを読み込み2次元NumPy配列として返却する Args: y_flipped: Trueの場合、読み込んだ画像を垂直方向に反転(デフォルト: True) Returns: 画像の2次元NumPy配列 Raises: MiscellaneousError: 画像ファイル名が見つからない場合 BinaryFileNotFound: バイナリファイルが存在しない場合
Source code in .build\ja\isdreader\chunks.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
CH_NUM_TO_LETTER = {1: 'A', 2: 'B', 3: 'C', 4: 'D'}
module-attribute
画像タイプの省略形からフルネームへのマッピング
BinaryFileNotFound
Bases: Exception
ISDフォルダ内に指定されたバイナリファイルが見つからない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
55 56 57 58 59 | |
DescriptionNotFound
Bases: Exception
ISDフォルダ内にDescription.xmlが見つからない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
41 42 43 44 45 | |
InsufficientMetaData
Bases: Exception
処理を続行するのに十分なメタデータが得られない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
48 49 50 51 52 | |
InvalidChannel
Bases: Exception
指定されたチャンネルインデックスが無効な場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
13 14 15 16 17 | |
InvalidDataGate
Bases: Exception
指定されたデータゲートインデックスが無効な場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
20 21 22 23 24 | |
InvalidSliceNo
Bases: Exception
指定されたスライス番号が無効な場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
27 28 29 30 31 | |
IsdNotFound
Bases: Exception
指定されたISDフォルダが存在しない場合に発生する例外
Source code in .build\ja\isdreader\isd_helper.py
34 35 36 37 38 | |
MiscellaneousError
Bases: Exception
その他の未知の理由で発生する例外
Source code in .build\ja\isdreader\isd_helper.py
62 63 64 65 66 | |
IsdReader
ISDフォルダ全体を現すルートクラス このクラスはISD取得データセット内の全チャンネル、DataGate、および画像アクセス のメインエントリポイントである すなわち、ISDデータ全体を包括するオブジェクトクラスとなる Attributes: path: 包括すべきISDフォルダへのパス description_path: Description.xmlファイルへのパス(ISD直下に固定) logger: このオブジェクト用のロガーインスタンス
Source code in .build\ja\isdreader\isd_root.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
GetCh(ch=None)
ChChunkインスタンスを取得、または全チャンネルをリストアップする Args: ch: None、或いは指定のChChunk番号 Returns: chがNoneの場合は利用可能なチャンネル番号のリストアップ、それ以外の場合は指定のChChunkまたはNone
Source code in .build\ja\isdreader\isd_root.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
GetImage(*, ch, gate, image_type, slice_no=1)
ImageChunkを直接取得するメソッド Args: ch: チャンネル番号(1オリジン) gate: DataGate番号(1オリジン) image_type: 画像タイプ(省略形、フルネーム) slice_no: スライス番号(1オリジン、デフォルト: 1) Returns: 指定された条件で見つかったImageChunkインスタンス、それ以外の場合はNone
Source code in .build\ja\isdreader\isd_root.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
__init__(*, isd_path, logger=None)
引数ISDフォルダからIsdReaderオブジェクトを初期化する Args: isd_path: ISDフォルダへのパス(文字列またはpathlib.Path)。 logger: オプションのロガーインスタンス。Noneの場合はデフォルトロガー Raises: TypeError: isd_pathが文字列またはPathでない場合 IsdNotFound: ISDフォルダが存在しない場合 DescriptionNotFound: ISDフォルダ内にDescription.xmlが見つからない場合
Source code in .build\ja\isdreader\isd_root.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
__repr__()
このIsdReaderの文字列による概要を返す Returns: サイズと利用可能なチャンネルを含む文字列
Source code in .build\ja\isdreader\isd_root.py
86 87 88 89 90 91 92 93 94 95 96 97 98 | |