0

I'm trying to understand the code below and what it does:

im = pilimage.open(img_path)
image_array = np.array(im)
imgstack = image_array[area[0]:area[1],
                       area[2]:area[3], z_stack[0]:z_stack[1]]

I know that it opens up an image and stores it in im and then converts im into an array and stores that in image_array. What I don't really understand is the last part. I don't have that much experience with python syntax so can anyone help me. Thank you so much!

2
  • 1
    A "reverse duplicate" of stackoverflow.com/questions/17277100/…. It's slicing the array in 3 dimensions. Commented Oct 2, 2019 at 19:48
  • What is image_array.shape? Commented Oct 3, 2019 at 3:40

1 Answer 1

0

This is an advanced-ish application of the python slice notation which you can learn about here: Understanding slice notation. There are a couple nuances here though:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.