Is there a neater way to check if coordinates can fit inside a image?

Just as title said.

Here’s what I have now:

# Code used in my current developing sorting library.
_crop_from_image(crop_ind,crop_length,axis,xpos,ypos,zpos,cpos)=(
		if(!same(
		  [isint(xpos,0,w##crop_ind-1),
		   isint(ypos,0,h##crop_ind-1),
		   isint(zpos,0,d##crop_ind-1),
		   isint(cpos,0,s##crop_ind-1)]
		 ,[1,1,1,1]),
			run('error coords_out_of_bound');
		);

# Blah codes
);

I’d say it is preferable to use this variant:

```
if (inrange(xpos,0,w##crop_ind,1,0) &&
    inrange(ypos,0,h##crop_ind,1,0) &&
    inrange(zpos,0,d##crop_ind,1,0) &&
    inrange(cpos,0,s##crop_ind,1,0,
 ... do stuffs ...)

because the use of the && makes it faster (evaluations are not done if one of the previous evaluation is false).

FYI :

So, in next release, it will be easier to test an out-of-range pixel :

c2o(x,y,z,c,1)<0?(
  ...  (x,y,z,c) is out-of-range ...
):(
  ... (x,y,z,c) is an image pixel ...
)

Hmm, question, as it seems that it takes vector argument. Does this means this can be used to test whether offset is out of range in I[#ind,offset] or in i[#ind,offset]? Both have different offset limits when spectrum>1. The size of vector argument should be what used to test the limit. If it is 1, then if it greater than max_x, then -1. If it is 2, then if it is greater than the bottom right corner, then -1. And so forth.