Skip to main content

Isd Reader Library for parsing ISD folder and loading binary images

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isdreader-0.0.5.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isdreader-0.0.5-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file isdreader-0.0.5.tar.gz.

File metadata

  • Download URL: isdreader-0.0.5.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for isdreader-0.0.5.tar.gz
Algorithm Hash digest
SHA256 313dc23b9e0c7fb290e5ffd99ef7eb88c1f5a6c1d0be85f588fee1bdd5ae28ca
MD5 75fe6c1c3b22d6563c1c0b094843aad0
BLAKE2b-256 dcbe006d4fc15b96015932f299b3382bdc0c9a28adca0707867a5c5f5da01ae0

See more details on using hashes here.

File details

Details for the file isdreader-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: isdreader-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for isdreader-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 26fd0d2748c0c9ed31fd9d501e89108f3d053f39050ea6c123edf46047afba7f
MD5 4c8bd1a96b572bc2953cb3a207220f80
BLAKE2b-256 753cd19fd63bbffe4e7ca34c4ffa8ec0a99d54c5b8e5c9923c9a23dffe225427

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page