-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultDatasetService creates ImgView with null factory #72
Comments
Logic is here. We just need to address the circular dependency somehow. |
Or should there be That way there doesn't need to be a circular dependency. |
After discussing with @awalter17, we agree that converters would be a good basis for convert ops that go from RAI to Img and II to Img. We think we would need six initially: But what about |
@ctrueden and @kkangle, I've reproduced the package net.imagej;
import net.imagej.display.DefaultDatasetView;
import net.imglib2.FinalInterval;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.img.ImgView;
import net.imglib2.type.numeric.integer.IntType;
import net.imglib2.util.ConstantUtils;
import org.scijava.Context;
import org.scijava.display.Display;
import org.scijava.display.DisplayService;
public class Main {
public static void main(final String[] args) {
final Context c = new Context();
final DisplayService display = c.getService(DisplayService.class);
final RandomAccessibleInterval<IntType> rai = ConstantUtils.constantRandomAccessibleInterval(new IntType(12), 2,
new FinalInterval(new long[] { 0, 0 }, new long[] { 10, 10 }));
final Display<?> d = display.createDisplay(rai);
final DefaultDatasetView datasetView = (DefaultDatasetView) d.get(0);
final Dataset dataset = datasetView.getData();
final ImgPlus<?> imgPlus = dataset.getImgPlus();
final Img<?> img = imgPlus.getImg();
if (img instanceof ImgView)
System.out.println("Is factory null? " + (((ImgView<?>) img).factory() == null));
// throws NPE
img.copy();
}
} |
Can this be closed since 6156a14 is merged to master? Or are we still considering making converters? |
I filed #74 to track any future work on the converters. |
The
DefaultDatasetService
creates anImgView
with anull
factory, see here. This shouldn't be done, as it can lead to problems later on (i.e. if you try to make a copy of the ImgView).There will need to be some logic for determining which factory should be created based on the size of the
RandomAccessibleInterval
.The text was updated successfully, but these errors were encountered: