# Size not supported for arrays with axes (-671:-1, -546:138)

**URL:** <https://discourse.julialang.org/t/size-not-supported-for-arrays-with-axes-671-1-546-138/12576>\
**Category:** General Usage\
**Created:** [July 22, 2018, 7:38am UTC](https://discourse.julialang.org/t/size-not-supported-for-arrays-with-axes-671-1-546-138/12576 "2018-07-22T07:38:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![microlifecc](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Post date:** [July 22, 2018, 7:38am UTC](https://discourse.julialang.org/t/size-not-supported-for-arrays-with-axes-671-1-546-138/12576/1 "2018-07-22T07:38:36Z")

</div>

I am not sure what I am doing wrong. This is my code:

```julia
subs(img, t) = img[1:round(Int, t):end, :];
delT = sqrt(2); n = 5; b = 72;
t_all = [delT^i for i in 0:5];
k = 2; t = 2;
theta = k*b/t;
tfm = LinearMap(RotMatrix(theta));
uR = warp(img1, inv(tfm));
uF = imfilter(uR, KernelFactors.gaussian((0, 0.8*t)));

# Here is the error:
uT = subs(uF, t);

```

> size not supported for arrays with axes (-671:-1, -546:138); see [http://docs.julialang.org/en/latest/devdocs/offset-arrays/](http://docs.julialang.org/en/latest/devdocs/offset-arrays/)
> 
> Stacktrace:  
> [1] errmsg(::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}) at /home/subhankar/.julia/v0.6/OffsetArrays/src/OffsetArrays.jl:94  
> [2] sqrt\_restrict(::OffsetArrays.OffsetArray{ColorTypes.Gray{Float64},2,Array{ColorTypes.Gray{Float64},2}}, ::Int64) at ./In[21]:1

Any help please? Thanks!

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [July 22, 2018, 7:56am UTC](https://discourse.julialang.org/t/size-not-supported-for-arrays-with-axes-671-1-546-138/12576/2 "2018-07-22T07:56:24Z")

</div>

Did you read the docs linked in the error? In particular: [https://docs.julialang.org/en/latest/devdocs/offset-arrays/#Using-axes-for-bounds-checks-and-loop-iteration-1](https://docs.julialang.org/en/latest/devdocs/offset-arrays/#Using-axes-for-bounds-checks-and-loop-iteration-1). You will need to define your indexing in `subs` differently.

---

<div class="post-metadata">

**Author:** ![microlifecc](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Post date:** [July 22, 2018, 8:06am UTC](https://discourse.julialang.org/t/size-not-supported-for-arrays-with-axes-671-1-546-138/12576/3 "2018-07-22T08:06:52Z")

</div>

Hi @mauro3,

Thanks a lot for the reply. Actually the paper I am trying to implement says I need to rotate the image and then subsample in vertical direction(hence the subs function). I am confused how I can still subsample vertically.

Also size(uF) gives me size not supported.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [July 22, 2018, 8:55am UTC](https://discourse.julialang.org/t/size-not-supported-for-arrays-with-axes-671-1-546-138/12576/4 "2018-07-22T08:55:50Z")

</div>

Yes, it’s an array who’s indices do not run from 1 to n, instead from some other number. From your error message it’s from -671 to -1 and -546 to 138. For these, so-called offset arrays, you need to do a few special things, which are described in that section of the docs, for instance instead of `size` you need to use `axes`, the docs indeed state: "replace many uses of `size` with `axes`. Please read the chapter of the docs first before asking more questions.
