File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/main/java/ai/nets/samj/ij/ui Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,20 @@ public void exportImageLabeling() {
204204 int width = activeImage .getWidth ();
205205 int height = activeImage .getHeight ();
206206 List <Mask > masks = new ArrayList <Mask >();
207- this .annotatedMask .stream ().filter (comm -> comm instanceof AddRoiCommand ).forEach (comm -> masks .addAll ( ((AddRoiCommand ) comm ).getMasks () ));
207+ List <String > doNotInclude = new ArrayList <String >();
208+ for (int i = this .annotatedMask .size () - 1 ; i >= 0 ; i --) {
209+ Command maskList = annotatedMask .get (i );
210+ if (maskList instanceof DeleteRoiCommand ) {
211+ for (Mask mm : maskList .getMasks ())
212+ doNotInclude .add (mm .getName ());
213+ } else if (maskList instanceof AddRoiCommand ) {
214+ for (Mask mm : maskList .getMasks ()) {
215+ if (doNotInclude .contains (mm .getName ()))
216+ continue ;
217+ masks .add (mm );
218+ }
219+ }
220+ }
208221 RandomAccessibleInterval <UnsignedShortType > raiMask = Mask .getMask (width , height , masks );
209222 ImagePlus impMask = ImageJFunctions .show (raiMask );
210223 impMask .setTitle (activeImage .getTitle () + "-labeling" );
You can’t perform that action at this time.
0 commit comments