Jump to content

Q: How to list all IMAQ images in memory


drjdpowell

Recommended Posts

As a side question, how do people deal with the non-standard way that IMAQ image references work (alway globally named; don't clean up when owning VI goes idle)?

For background, I am currently trying to get a large amount of non-reentrant image analysis code to work reentrantly, and have to deal with preventing one clone of a VI modifying an image inadvertently shared with another.  I am attacking the problem by auto-generating image names based on call site (ie, a pre-allocate clone that uses its own clone id in the image name):

120896225_2021-02-1717_47_58-ContextHelp.png.426eac48eec079e971432611efca9131.png

Edited by drjdpowell
Link to comment
21 minutes ago, drjdpowell said:

Is there any way to list all IMAQ images currently in memory?

How to get a list of image buffers?

22 minutes ago, drjdpowell said:

how do people deal with the non-standard way that IMAQ image references work

When I need some piece of code to run in a few instances simultaneously, I just set unique image names based on the meaning/purpose, what that code is invoked for (e.g., "sensor 1 - binarization" or "scanner - edge locator" and sort of). No extra magic here. And I even don't dispose the rest of images, as they are always reused on subsequent runs of the program (and between loop iterations too). Although I never launched too many IMAQ code in parallel (max. 5 threads, I think).

  • Thanks 1
Link to comment
1 hour ago, drjdpowell said:

As a side question, how do people deal with the non-standard way that IMAQ image references work (alway globally named; don't clean up when owning VI goes idle)?

Whenever it's been used in a project that I knew would persist more than for a simple demo, I've always wrapped the IMAQ API into an image class that handles the name generation with GUIDs to avoid collisions. Sometimes I'll add a singleton registry to keep track of references, but my IMAQ-flavored apps have generally been of low complexity, so I typically maintain a list of objects in the process' private data. When I need to leak the images across multiple processes, it is generally a delegation pattern, and the caller is still responsible for the reference's lifetime.

Link to comment

That's pretty much what I do too.  When I have a re-entrant VI that creates IMAQ refs, I use the VI clone name as part of the Image Name.  If you're concerned about the memory used when the VI isn't active, you can close the IMAQ refs and then later reopen them, but I don't usually bother doing this much anymore, as most (if not all) of my Imaging apps are developed in 64-bit now.

Link to comment
2 hours ago, Francois Normandin said:

Whenever it's been used in a project that I knew would persist more than for a simple demo, I've always wrapped the IMAQ API into an image class that handles the name generation with GUIDs to avoid collisions. Sometimes I'll add a singleton registry to keep track of references, but my IMAQ-flavored apps have generally been of low complexity, so I typically maintain a list of objects in the process' private data. When I need to leak the images across multiple processes, it is generally a delegation pattern, and the caller is still responsible for the reference's lifetime.

I would much rather than IMAQ references behaved the same as other LabVIEW references, like Queues.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.