Skip to content

Commit

Permalink
solve bug for rdg color images
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 22, 2024
1 parent 35ba0d0 commit e154ed3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/ai/nets/samj/ij/ui/IJComboBoxItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import ai.nets.samj.gui.components.ComboBoxItem;
import ij.ImagePlus;
import ij.plugin.CompositeConverter;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.img.display.imagej.ImageJFunctions;
Expand Down Expand Up @@ -72,8 +73,10 @@ public String getImageName() {
* Convert the {@link ImagePlus} into a {@link RandomAccessibleInterval}
*/
public <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> getImageAsImgLib2() {
Img<?> img = ImageJFunctions.wrap((ImagePlus) this.getValue());
return Cast.unchecked(img);
ImagePlus imp = (ImagePlus) this.getValue();
boolean isColorRGB = imp.getType() == ImagePlus.COLOR_RGB;
Img<?> image = ImageJFunctions.wrap(isColorRGB ? CompositeConverter.makeComposite(imp) : imp);
return Cast.unchecked(image);
}


Expand Down

0 comments on commit e154ed3

Please sign in to comment.