Home Image-Pro Automation (Macros, Apps, Reports)

Copy images from a SortedList to another SortedList

For the whole process I use multichannel images (Zeiss *.czi's). Certain channels are extracted and for further processing stored in a SortedList (named origImageList).
On the extracted channels various filters are applied and finally the number of objects is determined. Also modified channels are stored in a SortedList (named modImageList). During the process the modImageList is cleared and the origImageList should copied to the modImageList to start a new process.
The problem is that lists only store references and not values. I tried out different "DeepCopy" solutions like serialization without any success.  Look at the simple APP.
How can I transfer contents of a SortedList to another SortedList without a reference?

Thanks in advance
fsup

Best Answer

  • Answer ✓
    Hi fsup,

    I checked your project. All your collections contain references to images. If you want to keep 2 different collections, one original and another modified, you should create copies of these images using Duplicate function, like that:

            ' transfer to modImageList and apply for example lowpass filter
            For Each kvp In origImageList
                newInt = kvp.Key
                newIm = DirectCast(kvp.Value, McImage)
                newIm =newIm.Duplicate(mcImageCreateFlags.mcicfNotVisible Or mcImageCreateFlags.mcicfNoAddToCollection)
                LowPassFilterProcessing(newIm, 500, 1)
    
                modImageList.Add(newInt, newIm)
            Next
    

    Please let me know if that's what you wanted.

    Yuri

Answers

  • Thank you. That is great. This is exactly that what i am looking for.

    fsup
Sign In or Register to comment.