从输入参数生成x,y坐标

时间:2021-05-28 21:21:41

I am trying to overlay patient data on top of an optical image. I need to assign X,Y coordinates for each patient file in a bunch of designated boxes in the optical image.

我试图在光学图像上叠加患者数据。我需要在光学图像的一堆指定框中为每个患者文件分配X,Y坐标。

I am currently doing this by hand but I wanted to try and do this automatically by giving Excel the starting coordinate (for the upper left corner pixel of each box), the number of rows and columns for the box as well as the spacing between each pixel. I would need the X and Y coordinates in separate cells.

我目前正在手动执行此操作,但我想尝试通过为Excel提供起始坐标(每个框的左上角像素),框的行数和列数以及每个框之间的间距来自动执行此操作像素。我需要在单独的单元格中使用X和Y坐标。

For instance, for a box with 3 rows, 4 columns, pixel spacing of 20 and starting coordinates of (20,50), the output should look like:

例如,对于包含3行,4列,像素间距为20且起始坐标为(20,50)的框,输出应如下所示:

X    Y  
20   50  
40   50  
60   50  
80   50  
20   70  
40   70  
60   70  
80   70  
20   90  
40   90  
60   90  
80   90  

1 个解决方案

#1


According to your description maybe:

根据你的描述可能:

从输入参数生成x,y坐标

Formulas:

A8:

=IF(ROW(1:1)<=$B$1*$B$2,$B$4+MOD(ROW(1:1)-1,$B$2)*$B$3)

B8:

=IF(A8,$B$5+$B$3*INT((ROW(1:1)-1)/$B$2))

Both formulas copied downwards as needed.

两个公式都根据需要向下复制。

Transposed version:

从输入参数生成x,y坐标

Formulas:

B7:

=IF(COLUMN(A:A)<=$B$1*$B$2,$B$4+MOD(COLUMN(A:A)-1,$B$2)*$B$3)

B8:

=IF(B7,$B$5+$B$3*INT((COLUMN(A:A)-1)/$B$2))

Both formulas copied sidewards as needed.

两个公式都根据需要侧向复制。

#1


According to your description maybe:

根据你的描述可能:

从输入参数生成x,y坐标

Formulas:

A8:

=IF(ROW(1:1)<=$B$1*$B$2,$B$4+MOD(ROW(1:1)-1,$B$2)*$B$3)

B8:

=IF(A8,$B$5+$B$3*INT((ROW(1:1)-1)/$B$2))

Both formulas copied downwards as needed.

两个公式都根据需要向下复制。

Transposed version:

从输入参数生成x,y坐标

Formulas:

B7:

=IF(COLUMN(A:A)<=$B$1*$B$2,$B$4+MOD(COLUMN(A:A)-1,$B$2)*$B$3)

B8:

=IF(B7,$B$5+$B$3*INT((COLUMN(A:A)-1)/$B$2))

Both formulas copied sidewards as needed.

两个公式都根据需要侧向复制。