Distance transform repeats second frame for all subsequent

46 views
Skip to first unread message

Tamlyn Peel

unread,
Feb 10, 2017, 8:05:37 AM2/10/17
to Icy imaging
Hi

I'm creating a distance map from ROI on a single colour 3D image over time using the distance transforms plugin, but it has recently given me odd behaviour. The first two frames process correctly, but subsequent frames are just copies of the second frame. I'm using distance transforms in a script, but this happens with the plugin directly as well with ROI generated from HK Means plugin.

I reported a problem previously with distance mapping previously, no idea if it's related?

http://icy.bioimageanalysis.org/support?place=topic%2Ficy-software%2FBGConJZydqw%2Fdiscussion

Any help appreciated!

Cheers

Tamlyn

Alexandre Dufour

unread,
Feb 13, 2017, 11:30:38 AM2/13/17
to icy-so...@googlegroups.com
Hi Tamlyn,

Thx for the report. This should now be fixed in the latest update

Alexandre

--
You received this message because you are subscribed to the Google Groups "Icy imaging" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icy-software...@googlegroups.com.
To post to this group, send email to icy-so...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/icy-software/a06b5eac-1cc8-4652-b366-624ebde49742%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tamlyn Peel

unread,
Feb 13, 2017, 12:00:16 PM2/13/17
to Icy imaging
Hi Alexandre

Thanks for taking a look so quickly. I've updated the plugin, but whether Chamfer 3 or 5 it's now setting any frame after the 2nd with every voxel as max value (7898904.0). Different, but not correct behaviour!

The file I've tested is 582 x 522 x 26, 16 frames, 1 channel, double 64bit. Let me know if you need more info.

Cheers

Tamlyn

Alexandre Dufour

unread,
Feb 20, 2017, 6:47:31 AM2/20/17
to icy-so...@googlegroups.com
Hi Tamlyn,

I’ve just pushed another fix that should work better. Can you please double check? 

Cheers
Alexandre


Tamlyn Peel

unread,
Feb 20, 2017, 8:16:31 AM2/20/17
to Icy imaging
Hi Alexandre

Just tested version 2.0.3.0 with the same file, and unfortunately I get the same issue - 2nd frame onwards is just maxed out voxels with chamfer3 or 5. Is there anything else I can help with?

Cheers

Tamlyn

Alexandre Dufour

unread,
Feb 20, 2017, 8:22:42 AM2/20/17
to icy-so...@googlegroups.com
Just a quick check: is your ROI set to T=0 ? That would be the cause of the problem, because the ROI only “exists” on T=0 and not on the other ones (in which case set it to “ALL” to apply to all time points)

Alexandre


Tamlyn Peel

unread,
Feb 20, 2017, 8:41:14 AM2/20/17
to Icy imaging
Hi Alexandre

The test image (similar to images I'm generating) has 791 ROI, spread over 15 frames, all set to a specific t. The first two frames (t=0, t=1) seem to work fine. Is the number of ROI an issue? Would they need to be a single ROI per time point? I think it was working fine like this previously however.

Cheers

Tamlyn

Tamlyn Peel

unread,
Feb 20, 2017, 8:59:07 AM2/20/17
to Icy imaging
Hi Alexandre

I just checked the same image but with only the biggest ROI per time point present, and I get the same effect, with t=0 and t=1 giving the correct result, but all subsequent frames are maxed out voxels.

Cheers

Tamlyn

Alexandre Dufour

unread,
Feb 20, 2017, 9:04:24 AM2/20/17
to icy-so...@googlegroups.com
Strange, that is exactly what I am testing on and it works well on my side, both in 2D and 3D…
The number of ROI has no influence.

I’m a bit stuck here… Any chance the “only map selected ROI” option is checked by mistake?



Alexandre Dufour

unread,
Feb 20, 2017, 9:12:02 AM2/20/17
to icy-so...@googlegroups.com
So after further investigation, I did notice that I run on a new(er) kernel version (one that is not online yet), and I believe that there is an issue in the current version that causes the iterations over ROI to not work properly.

Perhaps Stephane could confirm this?


Tamlyn Peel

unread,
Feb 20, 2017, 9:30:30 AM2/20/17
to Icy imaging
Great, glad you might have a solution. 

I've moved to another PC and get the same issues here with that file, even with re-generating the ROI with HK-means again, keeping only one per time point etc and didn't help. But it was OK with a random 2D image I have with lots of ROI. 

Stephane

unread,
Feb 21, 2017, 5:21:09 AM2/21/17
to Icy imaging
Indeed an issue existed with the iterator when you had 3D ROI, it has been fixed in the last Icy version (not yet deployed).
Alexandre put a workaround in its Distance Transform plugin that you should able to update very soon so it will also work with Icy 1.8.6.0 :)

Best,

- Stephane


Le lundi 20 février 2017 15:12:02 UTC+1, Alexandre Dufour a écrit :
So after further investigation, I did notice that I run on a new(er) kernel version (one that is not online yet), and I believe that there is an issue in the current version that causes the iterations over ROI to not work properly.

Perhaps Stephane could confirm this?

Alexandre Dufour

unread,
Feb 21, 2017, 5:53:27 AM2/21/17
to icy-so...@googlegroups.com
Right, so I’m back with another fix (with Stephane’s help), which should work across the board.
I also took the occasion to speed things up by doing parallel computing on time series (one cpu per time point). 

Let me know if that works
Alexandre


Tamlyn Peel

unread,
Feb 21, 2017, 9:10:18 AM2/21/17
to Icy imaging
Hi Alexandre, Stephane

Tested the new plugin on both my test sample and with real data in a script, and it's working as expected now! The multithreading works on a 4 core and 8 core PC as well. Thanks for persevering!

The only thing is that once I have the distance map, my script loops through another set of ROI to get minimum intensity, but this only gives me non-zero values in the first two frames. While I'd expect some zeroes, I'd assumed this error was due to the incorrect distance transform, but now I guess this is due to the error with 3D ROI iterations? When will the newer kernel with the fix be released?

Thanks for your help!

Cheers

Tamlyn

Stephane

unread,
Feb 21, 2017, 9:35:17 AM2/21/17
to Icy imaging
Hi Tamlyn,

What are you using to retrieve the minimum intensity ?

- Stephane

Tamlyn Peel

unread,
Feb 21, 2017, 9:55:34 AM2/21/17
to Icy imaging
Hi Stephane, thansk for the quick reply

Using the ROI descriptor in Javascript as below:

importClass(Packages.plugins.kernel.roi.descriptor.intensity.ROIMinIntensityDescriptor)
...
currentROI = ROICollection.get(i);
minIntensity = ROIMinIntensityDescriptor.computeMinIntensity(currentROI, distanceMap)
...

3D ROI in the first two frames give non-zero values, but 3D ROI in every subsequent frame give zero, even when it's clear from the sequence they shouldn't be.

Cheers

Tamlyn

Stephane

unread,
Feb 21, 2017, 10:27:52 AM2/21/17
to Icy imaging
Ok so indeed you are impacted by the problem of 3D ROI on timelapse, i don't have date for the incoming version but hopefully it should arrive the next week. Still in the meantime you can use this code to fix this particular issue :

    className = currentROI.getClassName()

   
if (className.equals("plugins.kernel.roi.roi3d.ROI3DArea"))
   
{
        minIntensity
= 10000000
        it
= currentROI.iterator()
       
       
while(it.hasNext())
       
{
            v
= ROIMinIntensityDescriptor.computeMinIntensity(it.next(), s)
           
if (v < minIntensity)
                minIntensity
= v
       
}
   
}
   
else
        minIntensity
= ROIMinIntensityDescriptor.computeMinIntensity(currentROI, s)

It should return you the correct value.

Best,

- Stephane

Tamlyn Peel

unread,
Feb 21, 2017, 11:35:59 AM2/21/17
to Icy imaging
Hi Stephane,

Just added that code to my script, and looks like it works well. Thanks for all your help!

Cheers

Tamlyn
Reply all
Reply to author
Forward
0 new messages