pro transpose_grid, GRID=grid, COUNT=d, AXES=axes a = TRANSPOSE(REFORM(*grid, d, /OVERWRITE), axes mod 3) if axes[0] ge 3 then a = REVERSE(a, 1, /OVERWRITE) if axes[1] ge 3 then a = REVERSE(a, 2, /OVERWRITE) if axes[2] ge 3 then a = REVERSE(a, 3, /OVERWRITE) *grid = a end pro transpose_data, GRID_DATA=grid_data, COUNT=ii_d, INDICES=indices, AXES=axes for i=0L, n_elements(grid_data)-1 do begin d = ii_d[i,*] ; grids with a width of 1 in one or more dimensions may not be three-dimensional, necessitating a REFORM for j=0L, n_elements(indices)-1 do begin transpose_grid, GRID=grid_data[i].data[indices[j]], COUNT=d, AXES=axes endfor endfor end function axes_diff, OLD=old_axes, NEW=new_axes old_order = old_axes mod 3 & old_flip = old_axes ge 3 new_order = new_axes mod 3 & new_flip = new_axes ge 3 swap = [(where(old_order eq new_order[0]))[0], $ (where(old_order eq new_order[1]))[0], $ (where(old_order eq new_order[2]))[0]] swap += (old_flip[swap] xor new_flip) * 3 return, swap end function change_slice, PROJ=proj, NEW_SLICE=new_slice old_slice = proj.slice swap = axes_diff(OLD=old_slice.axes, NEW=new_slice.axes) if TOTAL(swap ne [0,1,2]) gt 0 then begin if PTR_VALID(proj.grid_data) then begin grid_data = *proj.grid_data transpose_data, GRID_DATA=grid_data, COUNT=(*proj.ii_d)[*,old_slice.axes mod 3]+2*proj.border, INDICES=LINDGEN(grid_data[0].n_dfields), AXES=swap endif new_proj = define_projection(GRIDS=*proj.grids, SLICE=new_slice, FASTMODE=1) new_proj.grid_data = proj.grid_data new_proj.part_data = proj.part_data new_proj.border = proj.border return, new_proj endif proj.slice = new_slice return, proj end pro change_slice_ori, PROJ=proj, NEW_ORI=new_ori @common_blocks.inc slice = define_slice(SLICE_ORI=new_ori, SLICE_SIZE=slice_size, SLICE_VALUE=slice_value, DEPTH_VALUE=depth_value, IMAGE_SIZE=proj.slice.image_size) proj = change_slice(PROJ=proj, NEW_SLICE=slice) end