GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Choose dtype for isolated buffer · Issue #369 · fastplotlib/fastplotlib

Choose dtype for isolated buffer #369

New issue
Copy link
New issue
Copy link
Closed
#511
Closed
Choose dtype for isolated buffer#369
#511
Copy link

Description

@kushalkolar
kushalkolar
opened on Nov 15, 2023
Issue body actions

I just noticed when using uint16 imaging data along with a frame_apply function in ImageWidget: lambda frame: frame - movie_mean, which results in negative values that overflow with numpy uint16 without raising warnings or exceptions. We could either always use float32 as the isolated buffer for ImageGraphic and/or allow choosing the dtype for the isolate buffer.

Activity

  1. kushalkolar commented on Nov 16, 2023

    @kushalkolar
    kushalkolar
    on Nov 16, 2023
    MemberAuthor
    More actions

    I propose always casting to float32 for the ImageDataFeature buffer, even simple things like Gaussian filters on uint8 or uint16 images result in overflow and meaningless results.

    without casting:
    image

    with casting:
    image

    I do not think we should expect users to worry about the limitations of the dtype of their raw image data if they are using ImageWidget with frame_apply functions etc. to interactively play with different types of processing 😄 So we should make casting to float32 automatic, unless there are downsides I cannot think of?

  2. clewis7 commented on Nov 16, 2023

    @clewis7
    clewis7
    on Nov 16, 2023
    Member
    More actions

    Sounds good to me...I think float32 gives enough flexibility

  3. ArjunPutcha commented on Nov 17, 2023

    @ArjunPutcha
    ArjunPutcha
    on Nov 17, 2023
    Collaborator
    More actions

    Agreed. Might still be useful to allow users to pass in dtype if necessary with default float 32. Some image data I acquire with sensor is uint16 or uint8 by default.

  4. kushalkolar commented on Nov 17, 2023

    @kushalkolar
    kushalkolar
    on Nov 17, 2023 via email
    MemberAuthor
    More actions
    I'm not sure how useful it would be to allow users to set the dtype of the internal buffer. uint isn't useful for any basic image processing. Do you have an example use case?
    …
    On Fri, Nov 17, 2023, 06:21 Arjun Putcha ***@***.***> wrote: Agreed. Might still be useful to allow users to pass in dtype if necessary with default float 32. Some image data I acquire with sensor is uint16 or uint8 by default. — Reply to this email directly, view it on GitHub <#369 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACHXXRHJRFDCXEAFO6XEY6DYE5CFFAVCNFSM6AAAAAA7NFBYJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJWGE4TMNZTHE> . You are receiving this because you authored the thread.Message ID: ***@***.***>
  5. ArjunPutcha commented on Nov 17, 2023

    @ArjunPutcha
    ArjunPutcha
    on Nov 17, 2023
    Collaborator
    More actions

    Most image data from sensors I typecast as uint 16 (in firmware) - I'm pretty sure some national instruments tools I use also do the same; generally I want to assess the raw data first to see if analog filtration is going well, not do any digital signal processing, so I'd just read in the data and visualize directly (no need for any additional typecasting).

    Reacted by Eric Thomson
  6. kushalkolar commented on Nov 18, 2023

    @kushalkolar
    kushalkolar
    on Nov 18, 2023
    MemberAuthor
    More actions

    ah ok, so in this case you would still want to use an isolated buffer but of the same type so it's 1-1 copying into the buffer.

  7. ArjunPutcha commented on Nov 18, 2023

    @ArjunPutcha
    ArjunPutcha
    on Nov 18, 2023
    Collaborator
    More actions

    Exactly. But I haven't benchmarked how long it takes; I think if you go from uint16 to int32, there's two conversion - uint16 to in16, and int16 to int32. I'd imagine you'd need to do the same to float32, but I'm not sure if the time required to do so is ridiculously long. I can benchmark this coming week.
    Also, if I were just visualizing analog data, I'd make a bunch of sensors testing different analog settings and visualize en masse

  8. kushalkolar
    closed this as completedin #511on Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.