<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Mark,<br>
      <br>
      I get the error for a dataset with axes > 2. I perpared some
      sample code (maybe something is wrong here) and I'll send you the
      file in a seperate mail.<br>
      <br>
      Regards Michael<br>
      <br>
      ----------------------------------------------------------------<br>
      <br>
          public static void main(String[] args) throws FormatException,
      IOException, ImgIOException, InstantiableException {<br>
                  String imgRef =
      "C:/Users/zinsmaie/Desktop/bilder/5d/2chZT.lsm";<br>
              <br>
                  Context c = new Context(SciJavaService.class,
      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
      DimRange("0")};<br>
      //                AxisType[] axes = new AxisType[] {Axes.CHANNEL};<br>
      //EXCEPTION<br>
                      DimRange[] ranges = new DimRange[] {new
      DimRange("0-10")};<br>
                      AxisType[] axes = new AxisType[] {Axes.Z};<br>
      //WORKS                <br>
      //                    DimRange[] ranges = new DimRange[] {new
      DimRange("0"), new DimRange("0-10")};<br>
      //                    AxisType[] axes = new AxisType[]
      {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(),
      options);<br>
              <br>
              System.out.println(ret.getName());<br>
          }<br>
    </div>
    <blockquote
cite="mid:CA+B=mGrHbPHJOESKfr54PTnrEh_FtoCWWE-1S7gnsoQJAROfHA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>Hi Michael,<br>
                      <br>
                    </div>
                     I was only able to reproduce this when trying to
                    create a SubRegion for Axes that weren't present.<br>
                    <br>
                  </div>
                   In the case of ImgOpener, Axes of length 1 are
                  discarded... so they effectively "aren't present" and
                  can't have a SubRegion applied to them (since they are
                  implicitly included anyway in the image).<br>
                  <br>
                </div>
                 Unfortunately, I'm not sure how to make the error
                reporting better, in general, on this issue.. since,
                when constructing a SubRegion, there's no way to know
                what dataset(s) it will be applied to... it's up to the
                consuming software to use the SubRegion information when
                reading the dataset.<br>
                <br>
              </div>
               I could add some defensive checks to verify that axes are
              present.. but this whole system is going to be reworked in
              0.7.0 for N-dimensionality. So I'm going to add a comment
              to our <a moz-do-not-send="true"
                href="https://github.com/scifio/scifio/issues/19">N-dim
                ticket</a> to test this.<br>
              <br>
            </div>
             For now, in your code, can you check if an axis length is
            < 2 before creating the SubRegion, and if so - don't add
            it to the SubRegion specification?<br>
            <br>
          </div>
           Oh - if you are getting this issue for Axes you know have a
          length > 1, send me the dataset, because something else is
          going on there. :)<br>
          <br>
        </div>
        Thanks,<br>
        Mark<br>
        <div>
          <div>
            <div>
              <div>
                <div><br>
                    <br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Fri, Aug 23, 2013 at 2:55 AM,
          Michael Zinsmaier <span dir="ltr"><<a
              moz-do-not-send="true"
              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
            together,<br>
            <br>
            defining intervals via the ImgOptions mechanism seems not to
            work if you define an Interval only for one Axes (except for
            Channel).<br>
            E.g. consider that you want to select only time=0 from a
            5dim Image (x,y,Channel,z,Time) and define the SubRegion as
            follows<br>
            new SubRegion(new AxesType[]{Time}, new Range[]{0}). An
            array index out of bounds exception is thrown.<br>
            <br>
            It does however work if you do the same thing with Channel
            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
            that is should not be necessary to specify Axes that I want
            to include completly.<br>
            I hope thats correct if not I would like to suggest to
            change it.<br>
            <br>
            Best regards<span class="HOEnZb"><font color="#888888"><br>
                Michael<br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>