Closed TylerJang closed 4 months ago
To provide a bit more visual context for this issue, this is the popup error dialogue box:
The log output at time of error looks like this:
the Imagej macro Window error report:
Started run tws on folder.bsh at Wed May 18 13:34:28 PDT 2022
Sourced file: inline evaluation of: `` import trainableSegmentation.WekaSegmentation; import trainableSegmentation . . . '' : Method Invocation segmentator.applyClassifier : at Line: 34 : in file: inline evaluation of: `` import trainableSegmentation.WekaSegmentation; import trainableSegmentation . . . '' : segmentator .applyClassifier ( image , 0 , getProbs )
Target exception: java.lang.NullPointerException
and the FIJI console window:
Thank you again for your time.
Hi, I am having the exact same issue. Does anyone know of a workaround?
Our solution was to revert to version 3.3.1 of TWS which fixed it for us has consistently been fine since we made that change.
Within ImageJ, how do you revert back to the previous version? - sorry, I'm a bit new to this.
You can uninstall and reinstall ImageJ to an older version. I don't believe you can do it within the application itself naturally since it is changing the version of ImageJ itself. I believe this is the version we reverted to https://downloads.imagej.net/fiji/archive/20201104-1356/
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
This fixes it for me. Perhaps it should/could be cleaned up as I don't think it is the right place for this. It just makes it work.
diff --git a/src/main/java/trainableSegmentation/WekaSegmentation.java b/src/main/java/trainableSegmentation/WekaSegmentation.java
index 306feae..efd8f3a 100644
--- a/src/main/java/trainableSegmentation/WekaSegmentation.java
+++ b/src/main/java/trainableSegmentation/WekaSegmentation.java
@@ -7443,7 +7443,7 @@ public class WekaSegmentation {
public void setFeaturesDirty()
{
updateFeatures = true;
- if( isProcessing3D )
+ if( isProcessing3D || null == featureStackArray)
return;
// Set feature stacks belonging to slices with traces
// to be updated during training and not test
@mlt Does it mean that we have to do our own compile of trainable weka or will it be released as new jar soon?
I don't know. I'm just a fellow user and not a project member. It is pretty easy to build the jar file with Maven though.
@mlt, if your code manages to solve the issue, would you mind opening a PR, and then I can try to contact Ignazio for the merge? Or I can also try to open the PR. I am also happy to open the PR if you let me know the changes.
Maybe @iarganda can chip in, since the fix for the bug is quite simple and it seems already implemented?
Indeed! I just need to find the moment to sit down and write the fix, sorry!!!
On Mon, Jan 29, 2024 at 4:49 PM Cano-Muniz, Santiago < @.***> wrote:
Maybe @iarganda https://github.com/iarganda can chip in, since the fix for the bug is quite simple and it seems already implemented?
— Reply to this email directly, view it on GitHub https://github.com/fiji/Trainable_Segmentation/issues/74#issuecomment-1914981186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA62TK6MA5RGRSFEAREZSZTYQ7AJZAVCNFSM5WJVZNF2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJRGQ4TQMJRHA3A . You are receiving this because you were mentioned.Message ID: @.***>
-- Ignacio Arganda-Carreras, Ph.D. Ikerbasque Research Associate Departamento de Ciencia de la Computacion e Inteligencia Artificial Facultad de Informatica, Universidad del Pais Vasco Paseo de Manuel Lardizabal, 1 20018 Donostia-San Sebastian Guipuzcoa, Spain
Phone : +34 943 01 73 25 Website: http://sites.google.com/site/iargandacarreras/
@iarganda let us know when you push the PR and the update is available in the update manager
@iarganda, I have just tested (see https://github.com/phisanti/Trainable_Segmentation) the solution proposed by user @mlt and it seems to work fine. Maybe merging the PR #81 will close the issue and then it can be pushed at the imageJ update site so everyone can benefit from it.
What is the situation with PMML in TWS? Is it used by anyone? I have not seen that capability advertised anywhere. How would one produce PMML given TWS generated features? I mean I can clean up the code further while at it. Alternatively, I can make the patch less invasive. It is just some code duplication that bothers me along with JUnit testing that uses file system (hence 6ac35bb303d22ae7ec8b28c0e42afbdc60cc5281 but I'm not sure whether to keep temporary file use with JUnit).
@iarganda, the user @mlt, and I already tested that the code changes work and opened PR. It would be helpful if you could accept the changes; that way, my colleagues can install the Weka plugin directly from the ImageJ plugin hub instead of downloading the version from my Git Hub. We understand that you, like everyone, have limited time to dedicate to open-source projects. If it is so, you have the option to give admin rights to other users. That will help keep the project alive, which otherwise might fade away.
Hi,
During the most recent version update, we have noticed that using load_classifier in the provided example Beanshell code from https://imagej.net/plugins/tws/scripting titled Example: apply classifier to all images in folder no longer works. Going to an older version of TWS, such as 3.3.1, fixes the issue and we notice that the version this error consistently occurs is in the most recent version 3.3.2.
When the following code executes, it returns the pop-up dialog warning "Could not apply Classifier!" for each image.
segmentator.loadClassifier( modelPath.getCanonicalPath() ); ... result = segmentator.applyClassifier(image, tilesPerDim, 0, true);
We suspect that the issue is in loading the classifier, but the error window is generated when applying the classifier.
We are using ImageJ version v1.53q through the Fiji distribution on Windows 10/Windows 7.
Thank you for your time.