0

I have an image array with dimensions [491,710,710]. For example. I want to delete the 25th and 30th images from this image. How can I do that ?

restore, 'C:\Users\User1\Desktop\TEZ\SUNSPOT_3_Crop\norm_Leke3.sav'

dim = SIZE(im8)
nfls = dim[1]

new_img = dblarr(nfls-2,710,710)

for i =0, nfls do begin
  IF i EQ 25 THEN begin
    i++
  ENDIF
  IF i EQ 30 THEN begin
    i++
new_img[i,*,*] = bytscl(im8[i,*,*])
endfor


end

I'm new to IDL. The code I think is like this. deleting the image yes but it gets black and still the same size([491,710,710]). If I delete the 25th and 30th images, my dimensions should be [399,710,710]. How can I fix it ?

mgalloy
  • 2,356
  • 1
  • 12
  • 10

1 Answers1

0

Try using indices like this:

; img is 401 by 710 by 710

mask = bytarr(401) + 1B
mask[[25, 30]] = 0B
keep_indices = where(mask, n_keep)

if (n_keep gt 0L) then begin
  new_img = img[keep_indices, *, *]
endif else new_img = !null
mgalloy
  • 2,356
  • 1
  • 12
  • 10