<div dir="ltr"><div><div><div><div>Hi Michael,<br><br> Right now I get an ArrayIndexOutOfBounds at line 60 of the ByteArrayLoader, as it tries to populate the ImgPlus using planes read by SCIFIO.<br><br></div> On my end, this is because the ImgPlus gets constrained properly to the desired subregion, but ImgOpener tries to jam in all 21 Z slices.. so the source is too big for the destination, and it gets AIOOB when copying, eventually.<br>
<br></div> Looks like the SubRegion application only considered if the SubRegion actually contains a given Axis for X and Y. Then for ZCT it just always applies whatever constraints it has. (e.g. it was trying to constrain C to 0-10 instead of Z, because the dimension order was CZT)<br>
<br></div> I standardized this check so it's the same for each axis, and now your code works for me :)<br><br></div><div> Fixed on latest master (<a href="https://github.com/scifio/scifio/issues/58">issue 58</a>).<br>
</div><div><br></div>- Mark<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 9:04 AM, Michael Zinsmaier <span dir="ltr"><<a href="mailto:michael.zinsmaier@gmx.de" target="_blank">michael.zinsmaier@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mark,<br>
<br>
if you get the same error that is thrown at my place its an ArrayIndexOutof Bounds ...<br>
I tried to track it down already and it might be an Error in ImgOpener readPlanes line 599 following.<br>
<br>
The while loop skips X, and Y but enters CHANNEL although the Subregion is set for Z which seems to be realted to this snippet<br>
"dimsPlaced < region.size()"<br>
<br>
I'm not sure what is going on there but it seems somehow incorrect (-: maybe this helps you<br>
<br>
best Michael<br>
<br>
<br>
Am Montag, 26. August 2013 15:38:44 schrieb Mark Hiner:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi Michael,<br>
<br>
I was able to confirm this code fails locally, although I don't think<br>
it's an issue with the calibration (or your code).<br>
<br>
Without SCIFIO-BF-compat, this fails because it defaults to the<br>
MinimalTIFFReader, which compresses the axes to a single plane (thus<br>
there is no Z, thus it fails).<br>
<br>
With SCIFIO-BF-compat, it opens correctly as an LSM.. but it seems<br>
that the ImgPlus that's created is too small. The # of dimensions are<br>
being read correctly (e.g., same as in the current FIJI) so I'm not<br>
sure why the array is the wrong size.. looking into it now.<br>
<br>
- Mark<br>
<br>
<br>
On Mon, Aug 26, 2013 at 1:07 AM, Michael Zinsmaier<br></div><div><div class="h5">
<<a href="mailto:michael.zinsmaier@gmx.de" target="_blank">michael.zinsmaier@gmx.de</a> <mailto:<a href="mailto:michael.zinsmaier@gmx.de" target="_blank">michael.zinsmaier@gmx.<u></u>de</a>>> wrote:<br>
<br>
Hi Mark,<br>
<br>
I get the error for a dataset with axes > 2. I perpared some<br>
sample code (maybe something is wrong here) and I'll send you the<br>
file in a seperate mail.<br>
<br>
Regards Michael<br>
<br>
------------------------------<u></u>------------------------------<u></u>----<br>
<br>
public static void main(String[] args) throws FormatException,<br>
IOException, ImgIOException, InstantiableException {<br>
String imgRef =<br>
"C:/Users/zinsmaie/Desktop/<u></u>bilder/5d/2chZT.lsm";<br>
<br>
Context c = new Context(SciJavaService.class,<br>
SCIFIOService.class);<br>
SCIFIO sci = new SCIFIO(c);<br>
<br>
Reader reader = sci.initializer()<br>
.initializeReader(imgRef, true);<br>
<br>
ImgOptions options = new ImgOptions();<br>
<br>
//WORKS<br>
// DimRange[] ranges = new DimRange[] {new<br>
DimRange("0")};<br>
// AxisType[] axes = new AxisType[] {Axes.CHANNEL};<br>
//EXCEPTION<br>
DimRange[] ranges = new DimRange[] {new<br>
DimRange("0-10")};<br>
AxisType[] axes = new AxisType[] {Axes.Z};<br>
//WORKS<br>
// DimRange[] ranges = new DimRange[] {new<br>
DimRange("0"), new DimRange("0-10")};<br>
// AxisType[] axes = new AxisType[]<br>
{Axes.CHANNEL, Axes.Z};<br>
<br>
<br>
options.setRegion(new SubRegion(axes, ranges));<br>
<br>
ImgPlus<RealType> ret = new ImgOpener().openImg(reader,<br>
new UnsignedByteType(), new ArrayImgFactory(),<br>
options);<br>
<br>
System.out.println(ret.<u></u>getName());<br>
}<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi Michael,<br>
<br>
I was only able to reproduce this when trying to create a<br>
SubRegion for Axes that weren't present.<br>
<br>
In the case of ImgOpener, Axes of length 1 are discarded... so<br>
they effectively "aren't present" and can't have a SubRegion<br>
applied to them (since they are implicitly included anyway in the<br>
image).<br>
<br>
Unfortunately, I'm not sure how to make the error reporting<br>
better, in general, on this issue.. since, when constructing a<br>
SubRegion, there's no way to know what dataset(s) it will be<br>
applied to... it's up to the consuming software to use the<br>
SubRegion information when reading the dataset.<br>
<br>
I could add some defensive checks to verify that axes are<br>
present.. but this whole system is going to be reworked in 0.7.0<br>
for N-dimensionality. So I'm going to add a comment to our N-dim<br></div></div>
ticket <<a href="https://github.com/scifio/scifio/issues/19" target="_blank">https://github.com/scifio/<u></u>scifio/issues/19</a>> to test this.<div class="im"><br>
<br>
For now, in your code, can you check if an axis length is < 2<br>
before creating the SubRegion, and if so - don't add it to the<br>
SubRegion specification?<br>
<br>
Oh - if you are getting this issue for Axes you know have a<br>
length > 1, send me the dataset, because something else is going<br>
on there. :)<br>
<br>
Thanks,<br>
Mark<br>
<br>
<br>
<br>
<br>
On Fri, Aug 23, 2013 at 2:55 AM, Michael Zinsmaier<br></div><div class="im">
<<a href="mailto:michael.zinsmaier@gmx.de" target="_blank">michael.zinsmaier@gmx.de</a> <mailto:<a href="mailto:michael.zinsmaier@gmx.de" target="_blank">michael.zinsmaier@gmx.<u></u>de</a>>> wrote:<br>
<br>
Hi together,<br>
<br>
defining intervals via the ImgOptions mechanism seems not to<br>
work if you define an Interval only for one Axes (except for<br>
Channel).<br>
E.g. consider that you want to select only time=0 from a 5dim<br>
Image (x,y,Channel,z,Time) and define the SubRegion as follows<br>
new SubRegion(new AxesType[]{Time}, new Range[]{0}). An array<br>
index out of bounds exception is thrown.<br>
<br>
It does however work if you do the same thing with Channel<br>
and it works also if you specify Ranges for Channel, Z and Time.<br>
<br>
The API of SubRegion (Map Constructor) gives me the feeling<br>
that is should not be necessary to specify Axes that I want<br>
to include completly.<br>
I hope thats correct if not I would like to suggest to change it.<br>
<br>
Best regards<br>
Michael<br>
<br>
<br>
</div></blockquote>
<br>
<br>
</blockquote>
<br>
<br>
</blockquote></div><br></div>