Resolved conflict in favour of release 1.3
r1943 | ffr | 2007-05-07 16:27:07 +1000 (Mon, 07 May 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
4ce126650e
commit
e6c78ef4d6
111
nxscript.c
111
nxscript.c
@@ -918,69 +918,35 @@ static void putArray(SConnection *pCon, SicsInterp *pSics,
|
|||||||
/* ANSTO MOD1 START */
|
/* ANSTO MOD1 START */
|
||||||
/**\brief Calculates polar angles on a 2D grid for cylindrical detectors.
|
/**\brief Calculates polar angles on a 2D grid for cylindrical detectors.
|
||||||
*
|
*
|
||||||
* param dradius detector radius
|
|
||||||
* param angsep angular separation between detector columns in radians
|
* param angsep angular separation between detector columns in radians
|
||||||
* param active_height_mm of a detector in mm
|
* param active_height_mm of a detector in mm
|
||||||
* param det_rot_rad detector rotation in radians
|
* param det_rot_rad detector rotation in radians
|
||||||
* param row_zero vertical pixel at beam centre.
|
|
||||||
* param ROI_row_offset horizontal pixel offset of ROI
|
|
||||||
* param col_zero horizontal pixel at beam centre for detector rotation of zero.
|
* param col_zero horizontal pixel at beam centre for detector rotation of zero.
|
||||||
* param ROI_col_offset vertical pixel offset of ROI
|
|
||||||
* param rownum number of detector rows
|
* param rownum number of detector rows
|
||||||
* param colnum number of detector columns
|
* param colnum number of detector columns
|
||||||
*
|
*
|
||||||
* Detector pixel layout uses display coordinates viewed from the sample.
|
* Detector pixel layout uses display coordinates viewed from the sample.
|
||||||
* ie If you stand at the sample and face the detector the (0,0) is at the
|
* ie If you stand at the sample and face the detector the (0,0) is at the
|
||||||
* left.
|
* top left corner.
|
||||||
*/
|
*/
|
||||||
float *G_TwoThetaArr=NULL;
|
float *G_TwoThetaArr=NULL;
|
||||||
void polar_angle(int folding, int dim, double dradius, double angsep, double active_height_mm, double det_rot_rad, double row_zero, double ROI_row_offset, double col_zero, double ROI_col_offset, double pixelrownum, double pixelcolnum) {
|
void polar_angle(double angsep, double active_height_mm, double det_rot_rad, double col_zero, double rownum, double colnum) {
|
||||||
|
|
||||||
int row,col;
|
int col;
|
||||||
double rowsep, height, alpha, pang;
|
double rowsep, alpha;
|
||||||
double rowstart, rowend, rownum, colnum, pixelrow, pixelcol;
|
double deg_per_rad = 57.29578;
|
||||||
|
|
||||||
if (folding == 1) {
|
|
||||||
rownum = pixelrownum;
|
|
||||||
colnum = pixelcolnum;
|
|
||||||
} else {
|
|
||||||
rownum = pixelrownum/2;
|
|
||||||
colnum = pixelcolnum*2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (G_TwoThetaArr != NULL)
|
if (G_TwoThetaArr != NULL)
|
||||||
free(G_TwoThetaArr);
|
free(G_TwoThetaArr);
|
||||||
|
|
||||||
G_TwoThetaArr = (float *)malloc(rownum*colnum*sizeof(float));
|
G_TwoThetaArr = (float *)malloc(colnum*sizeof(float));
|
||||||
|
|
||||||
|
|
||||||
rowsep = active_height_mm/(rownum-1);
|
rowsep = active_height_mm/(rownum-1);
|
||||||
|
|
||||||
if (dim==1) {
|
for (col=0; col < colnum; col++) {
|
||||||
rowstart = rownum/2;
|
alpha = fabs((col_zero - col)*angsep + det_rot_rad);
|
||||||
rowend = rownum/2;
|
G_TwoThetaArr[col]=(float)(alpha*deg_per_rad);
|
||||||
} else {
|
|
||||||
rowstart = 0;
|
|
||||||
rowend = rownum;
|
|
||||||
}
|
|
||||||
for (row=rowstart; row < rowend; row++) {
|
|
||||||
height=(row_zero - ROI_row_offset - row)*rowsep;
|
|
||||||
for (col=0; col < colnum; col++) {
|
|
||||||
alpha = (col_zero - ROI_col_offset - col)*angsep + det_rot_rad;
|
|
||||||
pang = acos(dradius * cos(alpha)/sqrt(dradius*dradius+ height*height));
|
|
||||||
if (folding == 1) {
|
|
||||||
G_TwoThetaArr[(int)(row*colnum+col)]=pang;
|
|
||||||
} else {
|
|
||||||
if (col%2==0) {
|
|
||||||
pixelrow = row + rownum;
|
|
||||||
pixelcol = col/2;
|
|
||||||
} else {
|
|
||||||
pixelrow = (rownum - 1) - row;
|
|
||||||
pixelcol = (col-1)/2;
|
|
||||||
}
|
|
||||||
G_TwoThetaArr[(int)(pixelrow*pixelcolnum+pixelcol)]=pang;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -992,9 +958,8 @@ static void putPolarArray(SConnection *pCon, SicsInterp *pSics,
|
|||||||
char buffer[256];
|
char buffer[256];
|
||||||
Tcl_Interp *tcl = NULL;
|
Tcl_Interp *tcl = NULL;
|
||||||
|
|
||||||
int folding, dim;
|
double angsep, det_rot_rad, active_height_mm;
|
||||||
double angsep, det_rot_rad, active_height_mm, rowsep;
|
double col_zero;
|
||||||
double row_zero, ROI_row_offset, col_zero, ROI_col_offset, dradius;
|
|
||||||
double rownum, colnum;
|
double rownum, colnum;
|
||||||
|
|
||||||
if(argc < 11){
|
if(argc < 11){
|
||||||
@@ -1017,79 +982,43 @@ static void putPolarArray(SConnection *pCon, SicsInterp *pSics,
|
|||||||
SCWrite(pCon,"ERROR: failed to convert size value list", eError);
|
SCWrite(pCon,"ERROR: failed to convert size value list", eError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Tcl_GetInt(tcl,argv[5],&folding);
|
status = Tcl_GetDouble(tcl,argv[5],&angsep);
|
||||||
if(status != TCL_OK){
|
if(status != TCL_OK){
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to int",argv[5]);
|
sprintf(buffer,"ERROR: failed to convert %s to double",argv[5]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Tcl_GetInt(tcl,argv[6],&dim);
|
status = Tcl_GetDouble(tcl,argv[6],&active_height_mm);
|
||||||
if(status != TCL_OK){
|
if(status != TCL_OK){
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to int",argv[6]);
|
sprintf(buffer,"ERROR: failed to convert %s to double",argv[6]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Tcl_GetDouble(tcl,argv[7],&dradius);
|
status = Tcl_GetDouble(tcl,argv[7],&det_rot_rad);
|
||||||
if(status != TCL_OK){
|
if(status != TCL_OK){
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[7]);
|
sprintf(buffer,"ERROR: failed to convert %s to double",argv[7]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Tcl_GetDouble(tcl,argv[8],&angsep);
|
status = Tcl_GetDouble(tcl,argv[8],&col_zero);
|
||||||
if(status != TCL_OK){
|
if(status != TCL_OK){
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[8]);
|
sprintf(buffer,"ERROR: failed to convert %s to double",argv[8]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Tcl_GetDouble(tcl,argv[9],&active_height_mm);
|
status = Tcl_GetDouble(tcl,argv[9],&rownum);
|
||||||
if(status != TCL_OK){
|
if(status != TCL_OK){
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[9]);
|
sprintf(buffer,"ERROR: failed to convert %s to double",argv[9]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = Tcl_GetDouble(tcl,argv[10],&det_rot_rad);
|
status = Tcl_GetDouble(tcl,argv[10],&colnum);
|
||||||
if(status != TCL_OK){
|
if(status != TCL_OK){
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[10]);
|
sprintf(buffer,"ERROR: failed to convert %s to double",argv[10]);
|
||||||
SCWrite(pCon,buffer,eError);
|
SCWrite(pCon,buffer,eError);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
status = Tcl_GetDouble(tcl,argv[11],&row_zero);
|
|
||||||
if(status != TCL_OK){
|
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[11]);
|
|
||||||
SCWrite(pCon,buffer,eError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status = Tcl_GetDouble(tcl,argv[12],&ROI_row_offset);
|
|
||||||
if(status != TCL_OK){
|
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[12]);
|
|
||||||
SCWrite(pCon,buffer,eError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status = Tcl_GetDouble(tcl,argv[13],&col_zero);
|
|
||||||
if(status != TCL_OK){
|
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[13]);
|
|
||||||
SCWrite(pCon,buffer,eError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status = Tcl_GetDouble(tcl,argv[14],&ROI_col_offset);
|
|
||||||
if(status != TCL_OK){
|
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[14]);
|
|
||||||
SCWrite(pCon,buffer,eError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status = Tcl_GetDouble(tcl,argv[15],&rownum);
|
|
||||||
if(status != TCL_OK){
|
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[15]);
|
|
||||||
SCWrite(pCon,buffer,eError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status = Tcl_GetDouble(tcl,argv[16],&colnum);
|
|
||||||
if(status != TCL_OK){
|
|
||||||
sprintf(buffer,"ERROR: failed to convert %s to double",argv[16]);
|
|
||||||
SCWrite(pCon,buffer,eError);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
polar_angle(folding, dim, dradius, angsep, active_height_mm, det_rot_rad, row_zero, ROI_row_offset, col_zero, ROI_col_offset, rownum, colnum);
|
polar_angle(angsep, active_height_mm, det_rot_rad, col_zero, rownum, colnum);
|
||||||
|
|
||||||
// status = NXDputalias(self->fileHandle, self->dictHandle,argv[2],G_TwoThetaArr);
|
// status = NXDputalias(self->fileHandle, self->dictHandle,argv[2],G_TwoThetaArr);
|
||||||
status = NXDopenalias(self->fileHandle, self->dictHandle,argv[2]);
|
status = NXDopenalias(self->fileHandle, self->dictHandle,argv[2]);
|
||||||
|
|||||||
Reference in New Issue
Block a user