IDL程序求解答解释解释这些多是什么

while(~done) do begin
if((current_wordcount ge wordcount) or (current_slice ge slices) or (dptr+1 ge (size(image_data))[1])) then begin
done = 1
break
endif

; reorder the bytes in the word对单词中的字节重新排序
t = ishft(fix(image_data[dptr + 1]), 8) or fix(image_data[dptr])   ;ishft将整数数组[1,2,3,4,5]的每个元素向左移位三位,并通过输入以下内容将结果存储在t中:

;fix将浮点数组[2.2,3.0,4.5,5.7]转换为整数类型,并通过输入以下内容将新数组存储在变量I中: t是整数型数组
dptr += 2L
current_wordcount++

if((t and '4000'X) ne 0) then begin ; 0x4000 start of a slice0x4000切片的开始  不等于
    ;;current_slices++
    total_bits = 0L

    this_slice_width = 0
    this_slice_first_shaded_bit = !PIXELS

    current_slice++ ; TAF why two current_slice++ in here???为什么这里有两个当前的_slice++
    current_pixel = 0L

    ; TAF, need to check below, for some reason getting blank leading slices on some particles?

    ; TAF update 2014-06-30 apprently the variable current_slices was a mistake, and current_slice should always be used,
    ; this was causing the program to skip the first slice of images with slices > 1
    ; TAF,需要在下面检查,出于某种原因,在某些粒子上获得空白的前导切片?
    ; TAF更新2014-06-30很明显,可变当前_切片是一个错误,应始终使用当前_切片,
    ; 这导致程序跳过切片>1的图像的第一个切片
    if(current_slice ge slices) then begin;大于

        ; this section handles some single pixel images which were being lost本节处理一些丢失的单像素图像
        if slices eq 1 then begin;等于

            if(current_slice eq 1) then begin
               ; TAF 2014-01-03 added to exit the loop instead of crashing, likely a better way to design the state machineTAF 2014-01-03增加了退出循环而不是崩溃,这可能是设计状态机的更好方法
                print, 'processparticles, current_slice = ', current_slice, ' slices = ', slices
                ;stop
                break
            endif

            ;uncompresss the image.
            clear_bits = t and '7F'X  ; '7F'X=0111,1111
            shaded_bits = ishft(t, -7) and '7F'X
            total_bits += clear_bits + shaded_bits
            total_shaded_pixels += shaded_bits

            if(shaded_bits gt 0) then begin;大于
                this_slice_first_shaded_bit = clear_bits
                this_slice_width = shaded_bits
                max_slice_width = this_slice_width;  ; for L4, the widest slice
                first_shaded_bit = this_slice_first_shaded_bit       ; for L5, total width of particle
            endif

            ; add to image
            current_pixel += clear_bits
            start_shade = current_pixel
            end_shade = start_shade + shaded_bits - 1

            if(start_shade lt !PIXELS and end_shade ge start_shade and end_shade lt !PIXELS) then begin ; color the image pixels
                if(start_shade eq end_shade) then begin
                    image[ start_shade, current_slice] = byte(0)
                    image2[start_shade, current_slice] = byte(1)
                endif else begin
                    image[ start_shade:end_shade, current_slice] = byte(0)
                    image2[start_shade:end_shade, current_slice] = byte(1) ; used to fill Bimage below用于填充下面的双页
                endelse
            endif

            if(end_shade gt last_shaded_bit) then begin ; for L5, total width of particle颗粒总宽度
                last_shaded_bit = end_shade
            endif

            if(shaded_bits gt max_shaded_bits) then begin ; for L2, the most shaded bits in a slice切片中阴影最多的位
                max_shaded_bits = shaded_bits
                midpoint = (end_shade - start_shade) / 2 + start_shade ; for PC1, the L2 midpoint, note that this will be the center of the longest section of shaded bits
            endif;对于PC1,L2中点,请注意这将是阴影位最长部分的中心

            if(start_shade eq 0) then begin ; touching first edge接触第一边缘
                edges or= '2'X ; image touching first edge flag (pixel 0 shaded)图像接触第一个边缘标志(像素0着色)
            endif

            if(end_shade eq !PIXELS - 1) then begin ; touching last edge
                edges or= '1'X ; image touching last edge flag (pixel 127 shaded)图像接触最后一个边缘标志(像素127着色)
            endif

            current_pixel += shaded_bits

            simage = label_region(image, /all_neighbors)
            num_satellites = max(simage)
        endif

        break ; exit while loop to avoid accessing outside allocated image退出while循环以避免访问外部分配的映像
    endif

    if(t eq '7FFF'X) then begin
        if(!flag_3VCPI) then begin ; 3V-CPI data format (ie NOT 2D-S/HVPS data format)
            ; 0x7FFF is the flag an uncompressed slice in 3V-CPI (the compression algorithm would have made it take more space)
            ; however, it should not be propagated to the SORTED file, so likely there is an error in Playback processing
            ; 3V-CPI数据格式(即非2D-S/HVPS数据格式)
            ; 0x7FFF是3V-CPI中未压缩切片的标志(压缩算法会使其占用更多空间)
            ; 但是,不应将其传播到已排序的文件,因此播放处理中可能存在错误
             clear_bits = 0L
            shaded_bits = 0L

            uncompress   = 0
            add_to_image = 0

            ; The following 8 words will be uncompressed image data in binary, expand and populate into the image
            ; 1 represents clear air, and 0 shaded
            ; 以下8个字将是二进制的未压缩图像数据,展开并填充到图像中
            ; 1表示空气清新,0表示阴影
            for i=0, 7 do begin
                ; crashes here quite a bit, do some better error checking on image_data and dptr!这里经常崩溃,对图像数据和dptr进行更好的错误检查!
                if(dptr+1 ge (size(image_data))[1]) then break

                t = ishft(fix(image_data[dptr]), 8) or fix(image_data[dptr+1])
                dptr += 2L
                current_wordcount++

                ;if((current_wordcount ge wordcount) or (current_slices ge slices)) then begin
                ;    done = 1
                ;    break
                ;endif

                ;if(dptr ge wordcount*2) then begin ; TAF 2013-12-24 the dptr was getting bigger than image for some reason, should fix raw data, but detecting in here prevents crashing
                ;    done = 1                        TAF 2013-12-24由于某种原因,dptr变得比图像更大,应该修复原始数据,但在这里进行检测可以防止崩溃
                ;    stop
                ;    break
                ;endif

                for j=0, 15 do begin
                    if((t and '8000'X) ne 0) then begin
                        ; clear air for this pixel; 此像素的清晰空气
                        clear_bits++
                    endif else begin
                        ; shaded for this pixel
                        image[ current_pixel, current_slice] = byte(0)
                        image2[current_pixel, current_slice] = byte(1)

                        shaded_bits++
                    endelse

                    current_pixel++

                    t = ishft(t, 1)
                endfor
            endfor
        endif else begin ; 2D-S/HVPS data format (ie NOT 3V-CPI data format)
            ; if(t eq '7FFF'X) then begin ; 0x7FFF is the flag for 128 clear bits in 2D-S, should never see this
             clear_bits = long(!PIXELS);如果(t等式'7FFF'X),则开始;0x7FFF是2D-S中128个清除位的标志,永远不会看到这一点
            shaded_bits = 0L

            uncompress   = 0
            add_to_image = 0
        endelse ; 2D-S/HVPS vs 3V-CPI handling for 0x7FFF flag
    endif else if(t eq '4000'X) then begin ; 0x4000 is defined as 128 shaded bits
         clear_bits = 0L
        shaded_bits = long(!PIXELS)

        uncompress   = 0
        add_to_image = 1
    endif else begin
        shaded_bits = 0L
         clear_bits = 0L

        uncompress   = 1
        add_to_image = 1
    endelse
endif else begin ; continue decompressing a slice
    if(current_slice eq -1) then begin
        ;print, "no start of slice detected, trying to advance...."
        current_slice++

        uncompress   = 0
        add_to_image = 0

        ;stop
    endif else begin
        uncompress   = 1
        add_to_image = 1
    endelse
endelse

if(uncompress) then begin
     clear_bits = t and '7F'X
    shaded_bits = ishft(t, -7) and '7F'X
endif

total_bits += clear_bits + shaded_bits

if(total_bits gt !PIXELS) then begin ; slice size exceeded error, skip to next slice
    ;print, "slice size exceeded error, truncating slice"

    if(clear_bits gt !PIXELS) then begin
        clear_bits = !PIXELS
        shaded_bits = 0
    endif else begin
        shaded_bits = !PIXELS - clear_bits
    endelse

    total_bits = !PIXELS
endif

total_shaded_pixels += shaded_bits

if(shaded_bits gt 0) then begin
    if(this_slice_width eq 0) then begin ; store the first bit this slice, also could use current_pixel eq 0L
        this_slice_first_shaded_bit = clear_bits
        this_slice_width = shaded_bits
    endif else begin
        this_slice_width += clear_bits + shaded_bits
    endelse

    if(this_slice_width gt max_slice_width) then begin ; for L4, the widest slice
        max_slice_width = this_slice_width
    endif

    if(clear_bits eq 0 and current_pixel ne 0L) then begin
        ; would have to handle adding shaded bits to the equivalent of potential_contiguous_shaded_bits

        print, "clear_bits eq 0 and current_pixel =", current_pixel ; can be first edge pixel, are there other cases?
        ;stop
    endif

    if(this_slice_first_shaded_bit lt first_shaded_bit) then begin ; for L5, total width of particle
        first_shaded_bit = this_slice_first_shaded_bit
    endif
endif

if(add_to_image) then begin
    current_pixel += clear_bits

    start_shade = current_pixel
      end_shade = start_shade + shaded_bits - 1

    if(start_shade lt !PIXELS and end_shade ge start_shade and end_shade lt !PIXELS) then begin ; color the image pixels
        if(start_shade eq end_shade) then begin
            image[ start_shade, current_slice] = byte(0)
            image2[start_shade, current_slice] = byte(1)
        endif else begin
            image[ start_shade:end_shade, current_slice] = byte(0)
            image2[start_shade:end_shade, current_slice] = byte(1) ; used to fill Bimage below
        endelse
    endif

    if(end_shade gt last_shaded_bit) then begin ; for L5, total width of particle
        last_shaded_bit = end_shade
    endif

    if(shaded_bits gt max_shaded_bits) then begin ; for L2, the most shaded bits in a slice
        max_shaded_bits = shaded_bits
        midpoint = (end_shade - start_shade) / 2 + start_shade ; for PC1, the L2 midpoint, note that this will be the center of the longest section of shaded bits
    endif

    if(start_shade eq 0) then begin ; touching first edge
        edges or= '2'X ; image touching first edge flag (pixel 0 shaded)
    endif

    if(end_shade eq !PIXELS - 1) then begin ; touching last edge
        edges or= '1'X ; image touching last edge flag (pixel 127 shaded)图像接触最后一个边缘标志(像素127着色)
    endif

    current_pixel += shaded_bits
endif

endwhile ; image decompression loop

area = total_shaded_pixels

L2 = max_shaded_bits ; L2, most shaded bits in a slice切片中的大多数着色位
L4 = max_slice_width ; L4, the widest single sliceL4,最宽的单片

L5 = last_shaded_bit - first_shaded_bit + 1 ; L5, the max width of the particle across all slices

END ; DEcompressImageMM

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。