Skip to main content

isdreader

License: MIT PyPI version Python Versions Wheel

isdreader

isdreader is a Python library for parsing ISD folders and loading binary inspection image data as NumPy arrays.

Installation

pip install isdreader

Documentation

https://insightkk.net/isdreader/

Data structure

InsightScanDataは多数のC-imageデータを含んでおり、1つのCイメージデータを取り出すためにはツリー構造になっているオブジェクトを辿ってアクセスする必要があります。 DataStruct

次のソースコードはInsightScanDataオブジェクトの中にあるCイメージデータを表示する例です

if __name__ == "__main__":
    from isdreader import InsightScanData
    from isdreader import ImageBlender
    your_isd_path = r"C:\XXXX\XXXX\sample.isd"
    isd = InsightScanData(your_isd_path)
    print(isd)
    for ch in isd.AdcChannels:
        print(f"<Channel>: {ch.Name}")
        for gate in ch.Gates:
            print(f" |--<Gate>: {gate.Name}, Type: {gate.Type}")
            for img in gate.Cimages:
                print(f" |    |---: {img}")

C-image

Cイメージオブジェクトは、Numpy配列形式の画像データの提供と付加情報を提供します。 次のソースコードは画像のサイズおよびデータを確認する例です。

if __name__ == "__main__":
    from isdreader import InsightScanData
    your_isd_path = r"C:\XXXX\XXXX\sample.isd"
    #isd object instance
    isd = InsightScanData(your_isd_path)
    #get terget C-image
    cimage = isd.Channel1.DATA1_01.AbsPeak
    print(f"Name={cimage.Name}")
    print(f"PhysicalSize={cimage.Size}")
    print(f"PixelSize={cimage.PixelSize}")
    print(cimage.RawData())     #Binary data
    print(cimage.EchoData())    #Normalized data(include NoData)

画像データ形式

CイメージのRawDataとして保存されているBinaryデータはMSBが符号で,その他のbitが振幅を表現します。 ただし、Allゼロのデータは特別でNodata(FSFを検出しない画素)を表現します。Outlineオプションを利用している場合は1を示すデータも特別な扱いになることに注意してください。

多くのデータ解析ではRawDataを利用しません。 -1~+1の範囲に正規化されたNormlizedデータを利用してください。 また、Nodataの画素を解析対象から除外したい場合は、 EchoDataメソッドを利用してデータを取得することで、Nodata画素が np.nanに置き換わった配列を取得することを利用してください。

画像データの表示

取得したNumpy形式のデータ配列を可視化する方法は様々です。 isdreaderパッケージには,可視化を手助けするImageBlenderクラスを含んでいます。

ImageBlenderクラスにC-imageオブジェクトを渡してインスタンスすることで手軽に画像の確認ができます。 ImageBlenderに渡されたデータはグレースケールのPbsPeakと同様に着色されます。

alt text

if __name__ == "__main__":
    from isdreader import InsightScanData, ImageBlender
    your_isd_path = r"C:\XXXX\XXXX\sample.isd"
    isd = InsightScanData(your_isd_path)
    cimage = isd.Channel1.DATA1_01.AbsPeak
    echo_data = cimage.EchoData(Outline=False)
    blender = ImageBlender(base_image=echo_data)
    blender.show()

画像データのトリミング

データ取得メソッドには,トリミング範囲の指定をするオプション引数があります。 トリミング範囲の指定には、4つのパラメータを含むタプルを用意します。 タプルは先頭から左上起点の水平画素位置、左上起点の垂直画素位置、画素数での幅、画素数での高さを整数で指定してください。 次のソースコードはトリムの例です。

from isdreader import InsightScanData,ImageBlender
your_isd_path = r"C:\XXXX\XXXX\sample.isd"
isd = InsightScanData(your_isd_path)
cimage = isd.Channel1.DATA1_01.AbsPeak
range = (400, 400, 500, 500) #Trimming range : x,y,width,hight
echo_data = cimage.EchoData(range,Outline=False)
blender = ImageBlender(base_image=echo_data)
blender.show()

alt text

Metadata

Release files for isdreader 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isdreader 0.0.5
File Size Uploaded Provenance Actions
isdreader-0.0.5.tar.gz 31.3 kB Without provenance Details for isdreader-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for isdreader 0.0.5
File Interpreter ABI Platform Actions
isdreader-0.0.5-py3-none-any.whl Python 3 none any Details for isdreader-0.0.5-py3-none-any.whl

Total release size: 66.6 kB

Release files / isdreader-0.0.5.tar.gz

Download URL isdreader-0.0.5.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
313dc23b9e0c7fb290e5ffd99ef7eb88c1f5a6c1d0be85f588fee1bdd5ae28ca
BLAKE2b-256 checksum
How to use checksums
dcbe006d4fc15b96015932f299b3382bdc0c9a28adca0707867a5c5f5da01ae0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / isdreader-0.0.5-py3-none-any.whl

Download URL isdreader-0.0.5-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26fd0d2748c0c9ed31fd9d501e89108f3d053f39050ea6c123edf46047afba7f
BLAKE2b-256 checksum
How to use checksums
753cd19fd63bbffe4e7ca34c4ffa8ec0a99d54c5b8e5c9923c9a23dffe225427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for isdreader 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page