NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 380 - PreprocessorScripts are ignored
PreprocessorScripts are ignored
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: TrakEM2
unspecified
PC Linux
: P2 normal
Assigned To: Albert Cardona
Depends on:
Blocks:
 
Reported: 2011-11-07 11:12 CST by Stephan Saalfeld
Modified: 2011-11-07 21:58 CST
1 user (show)

See Also:

Description Stephan Saalfeld 2011-11-07 11:12:52 CST
I found that previously working preprocessor scripts are ignored currently.  A fast trial to trace back where the behavior turned out being complicated because of the recent API-change tracking the ImageJA to ImageJ transition.  Looking into it in more detail now but if somebody else has a faster clue, please go ahead.
Comment 1 Stephan Saalfeld 2011-11-07 11:25:26 CST
I found that it must be due to the image cache not being updated.  Flushing the image cache followed by regenerating the mipmaps for the respective patches renders them with the PPS applied (or removed, removing it shows the same effect).
Comment 2 Stephan Saalfeld 2011-11-07 12:28:21 CST
Found a candidate:  The method Cache.removeImagePlus(Pyramid) does lots of things but only removed the ImagePlus if ImagePlusUsers was empty.  In the described situation, ImagePlusUsers was null.  Albert, can you please review this commit and check if the desired behavior is still there?  I do not know what those ImagePlusUsers are.  Thanks in advance.
Comment 3 Albert Cardona 2011-11-07 18:08:29 CST
(In reply to comment #2)
> Found a candidate:  The method Cache.removeImagePlus(Pyramid) does lots of
> things but only removed the ImagePlus if ImagePlusUsers was empty.  In the
> described situation, ImagePlusUsers was null.  Albert, can you please review
> this commit and check if the desired behavior is still there?  I do not know
> what those ImagePlusUsers are.  Thanks in advance.

Two or more Patch instances may point to exactly the same image file. Therefore they are users of the same ImagePlus. Generally there is only one user. A situation when there are two is after splitting an image in two parts.

If ImagePlusUsers was null, then there is an error somewhere else in the Cache: adding an ImagePlus is not adding an ImagePlusUser but it should.

Comment 4 Albert Cardona 2011-11-07 18:24:33 CST
I think I got it:

/** Returns null if the ImagePlus was preprocessed or doesn't have an original FileInfo
	 * (which means the image does not come from a file). */
static public final String getPath(final ImagePlus imp) {

... the above indicates that when there is a preprocessor script, the ImagePlus does not have an associated file path and is not stored as having any users, given that the combination of file path and preprocessor script generates a unique ImagePlus.

I've pushed a couple of fixes that ensure that cache space is reclaimed only when the ImagePlus is no longer referenced. Let me know if the bug can be closed.
Comment 5 Albert Cardona 2011-11-07 21:23:47 CST
More fixes pushed for the Cache. There was a long-standing error that caused ImagePlus to never be released when calling removeImagePlus(long id).

See: http://repo.or.cz/w/trakem2.git/commit/bee086761f1d7609b18d6f2c4d28f86608dc52f0
Comment 6 Stephan Saalfeld 2011-11-07 21:58:09 CST
Thanks!