「lmrcImageOrientationSearchBySimultaneousMinimization(API)」の版間の差分
 (ページの作成:「DataManip/transform/src/'''lmrcImageOrientationSearchBySimultaneousMinimization'''はmrcImageOrientationSearchBySimultaneousMinimizationのためのAPI です。  == ...」)  | 
				 (→API)  | 
				||
| (同じ利用者による、間の13版が非表示) | |||
| 行62: | 行62: | ||
== API ==  | == API ==  | ||
| − | + | === ファイル読み込み ===  | |
| − | + | ファイルfptから初期データを読み込みます。  | |
| − | + |   void  | |
| − | + |   lInitialDataFileRead(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, FILE* fpt, int mode);  | |
| − | + | 各i行についてそれぞれの列に対応したデータをlinfo->angle[i]のメンバへ格納します。  | |
| − | + | <table border=1>  | |
| − | + | 	<tr>  | |
| + | 		<th>列</th>  | ||
| + | 		<th>linfo->angle[i]のメンバ</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>3</td>  | ||
| + | 		<td>phi</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>4</td>  | ||
| + | 		<td>theta</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>5</td>  | ||
| + | 		<td>psi</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
| + | === 角度の組み合わせ ===  | ||
| + | linfo->dthetaからphi, thetaの角度の組み合わせ数を返します。  | ||
  int  |   int  | ||
  lJcalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, int mode);  |   lJcalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, int mode);  | ||
| + | <br>  | ||
| + | linfo->dthetaからphi, thetaの角度の組み合わせを算出し、planerotationAngleへ格納します。  | ||
  void  |   void  | ||
  lPlaneRotationAngleSet(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, PlaneRotationAngle* planerotationAngle, int mode);  |   lPlaneRotationAngleSet(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, PlaneRotationAngle* planerotationAngle, int mode);  | ||
| + | <br>  | ||
| − | + | commonlinedataによる角度の組み合わせとPlaneRotationFileNumによる面内回転を含む角度の組み合わせをcommonlinedataWithPlaneRotationへ格納します。  | |
| − | + | ||
| − | + | ||
  void  |   void  | ||
  lCommonLineDataSetInPlaneRotation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* commonlinedata,  |   lCommonLineDataSetInPlaneRotation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* commonlinedata,  | ||
                                    CommonLineData* commonlinedataWithPlaneRotation, int PlaneRotationNum, int CommonLineNum, int i,  |                                     CommonLineData* commonlinedataWithPlaneRotation, int PlaneRotationNum, int CommonLineNum, int i,  | ||
                                    int* PlaneRotationFileNum, mrcImage* ref, int mode);  |                                     int* PlaneRotationFileNum, mrcImage* ref, int mode);  | ||
| + | commonlinedataWithPlaneRotationの0 ~ PlaneRotationNum - 1までの要素にcommonlinedataの組み合わせが格納され、以降の要素に面内回転を含めた角度の組み合わせが格納されます。<br>  | ||
| + | <br>  | ||
| + | Workcommonlinedataの各要素のメンバの内、angleRef, angleOhter, numをそれぞれlinfoの各要素へ格納します。<br>  | ||
| + | また、面内回転によって重なる画像数を返します。  | ||
  int  |   int  | ||
  lCommonLinesDataSet(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* Workcommonlinedata, CommonLineData* commonlinedata, int mode);  |   lCommonLinesDataSet(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* Workcommonlinedata, CommonLineData* commonlinedata, int mode);  | ||
| + | <br>  | ||
| + | === コモンライン ===  | ||
| + | Lの算出  | ||
| + |  double  | ||
| + |  lLcalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, mrcImage* refOneLineFT, mrcImage* otherOneLineFT,   | ||
| + |  			  mrcImage* refOneLineSino, mrcImage* otherOneLineSino, CommonLineData* commonlinedata, double delU, int Num, int mode);  | ||
| + | |||
| + | linfo->ModeLによりLの算出方法を選択できます。  | ||
| + | <table border="1">  | ||
| + | 	<tr>   | ||
| + | 		<th>linfo->ModeL</th>   | ||
| + | 		<th>説明</th>   | ||
| + | 	</tr>   | ||
| + | 	<tr>   | ||
| + | 		<td>0</td>   | ||
| + | 		<td>differential of length</td>   | ||
| + | 	</tr>   | ||
| + | 	<tr>   | ||
| + | 		<td>1</td>   | ||
| + | 		<td>differential of phase</td>   | ||
| + | 	</tr>   | ||
| + | 	<tr>   | ||
| + | 		<td>2</td>   | ||
| + | 		<td>addition to derivation1D (multiply)</td>   | ||
| + | 	</tr>   | ||
| + | 	<tr>   | ||
| + | 		<td>3</td>   | ||
| + | 		<td>addition to derivation1D (difference)</td>   | ||
| + | 	</tr>   | ||
| + | </table>   | ||
| + | <br>  | ||
| + | |||
| + | linfo->ModeCalculationAreaによりLの算出範囲を設定します。  | ||
| + | <table border="1">  | ||
| + | 	<tr>   | ||
| + | 		<th>linfo->ModeCalculationArea</th>   | ||
| + | 		<th>説明</th>   | ||
| + | 	</tr>   | ||
| + | 	<tr>   | ||
| + | 		<td>0</td>   | ||
| + | 		<td>全ての範囲</td>   | ||
| + | 	</tr>   | ||
| + | 	<tr>   | ||
| + | 		<td>1</td>   | ||
| + | 		<td>linfo->ThresholdCalculationArea/delU以下はカット</td>   | ||
| + | 	</tr>   | ||
| + | </table>   | ||
| + | <br>  | ||
| + | |||
| + | CommonLineInfoから全てのコモンライン数を返します。  | ||
| + |  int  | ||
| + |  lAllCommonLineCalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, lCommonLineCalculationInfo* CommonLineInfo, int N,  | ||
| + |                            PlaneRotationAngle* planerotationAngle, CommonLineData* Workcommonlinedata, int j, int mode);  | ||
| + | <br>  | ||
| + | |||
| + | commonlinedata[i].angleRefからコモンラインの重みを算出し、commonlinedata[i].angularweightに格納します。  | ||
  void  |   void  | ||
| − | + |   lAngularWeightCalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* commonlinedata, int CommonLineNum, int mode);  | |
| + | linfo->ModeThresholdAngularにより角度の閾値を設定できます。  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>linfo->ModeThresholdAngular</th>  | ||
| + | 		<th>角度の閾値</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>0</td>  | ||
| + | 		<td>1.0e-4</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>1</td>  | ||
| + | 		<td>M_PI/180</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>2</td>  | ||
| + | 		<td>linfo->dpsi</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
| + | === 1Dデータの抽出 ===  | ||
| + | 入力in(実画像)から角度angle[radian]の成分のみを取り出し、outへ格納します。  | ||
  void  |   void  | ||
  lmrcImageOneLineGet(mrcImage* out, mrcImage* in, float angle, int mode);  |   lmrcImageOneLineGet(mrcImage* out, mrcImage* in, float angle, int mode);  | ||
| + | <br>  | ||
| + | 入力in(フーリエ画像)から角度angle[radian]の成分のみを取り出し、outへ格納します。  | ||
  void  |   void  | ||
  lmrcImageFTOneLineGet(mrcImage* out, mrcImage* in, float angle, int mode);  |   lmrcImageFTOneLineGet(mrcImage* out, mrcImage* in, float angle, int mode);  | ||
| + | <br>  | ||
| + | フーリエ画像から指定した角度[radian]の成分のみを取り出します。  | ||
  void  |   void  | ||
  lmrcImageOneLineFTCreate(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, mrcImage* ref, mrcImage* other,  |   lmrcImageOneLineFTCreate(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, mrcImage* ref, mrcImage* other,  | ||
                           mrcImage* refOneLineFT, mrcImage* otherOneLineFT, float RefAngle, float OtherAngle, int mode);  |                            mrcImage* refOneLineFT, mrcImage* otherOneLineFT, float RefAngle, float OtherAngle, int mode);  | ||
| + | 入力、角度、出力は下記のようになっています。<br>  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>入力</th>  | ||
| + | 		<th>角度</th>  | ||
| + | 		<th>出力</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>ref</td>  | ||
| + | 		<td>RefAngle</td>  | ||
| + | 		<td>refOneLineFT</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>other</td>  | ||
| + | 		<td>OtherAngle</td>  | ||
| + | 		<td>otherOneLineFT</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
| + | === 相関 ===  | ||
| + | 入力inの参照refに対する重み付き相関値を返します。OhtsuMethodによる二値化データを閾値として使用しています。  | ||
  double    |   double    | ||
  lmrcImageOneLineSinogramCorrelationAdditionalWeight(mrcImage* in, mrcImage* ref, int mode);  |   lmrcImageOneLineSinogramCorrelationAdditionalWeight(mrcImage* in, mrcImage* ref, int mode);  | ||
| + | modeによって相関方法を選択できます。  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>mode</th>  | ||
| + | 		<th>相関方法</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>2</td>  | ||
| + | 		<td>multiply</td>  | ||
| + | 		</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>3</td>  | ||
| + | 		<td>difference</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
2015年3月23日 (月) 08:12時点における最新版
DataManip/transform/src/lmrcImageOrientationSearchBySimultaneousMinimizationはmrcImageOrientationSearchBySimultaneousMinimizationのためのAPI です。
定数
#define WORDLEN (1024) #define PHIMIN (0) #define PHIMAX (2*M_PI-(M_PI/180/2)) #define THETAMIN (0) #define THETAMAX (M_PI) #define PSIMIN (0) #define PSIMAX (2*M_PI-(M_PI/180/2))
構造体
typedef struct EulerAngle {
	char* filename;
	float phi;
	float theta;
	float psi;
} EulerAngle;
typedef struct lmrcImageOrientationSearchBySimultaneousMinimizationInfo {
	int    filenum;
	char*  OutFileName;
	float  dtheta;
	float  dpsi;
	int    mode;
	int    initialrandomdata;
	int    modeinitialdata;
	int    ModeStartPoint;
	int    ModeAngularArea;
	int    ModeL;
	int    ModeThresholdAngular;
	int    ModeCalculationArea;
	int    ModeFix;
	double ThresholdCalculationArea;
	char*  LogFileName;
	char*  Log2FileName;
	char*  mrc2dFileName;
	char*  mrc3dFileName;
	int    MaxCount;
	char*  FileNameHeader;
	EulerAngle* angle;
} lmrcImageOrientationSearchBySimultaneousMinimizationInfo;
typedef struct PlaneRotationAngle {
	float theta;
	float phi;
} PlaneRotationAngle;
typedef struct CommonLineData {
	float angleRef;
	float angleOther;
	float angularweight;
	int   num;
	int   flag;
} CommonLineData;
API
ファイル読み込み
ファイルfptから初期データを読み込みます。
void lInitialDataFileRead(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, FILE* fpt, int mode);
各i行についてそれぞれの列に対応したデータをlinfo->angle[i]のメンバへ格納します。
| 列 | linfo->angle[i]のメンバ | 
|---|---|
| 3 | phi | 
| 4 | theta | 
| 5 | psi | 
角度の組み合わせ
linfo->dthetaからphi, thetaの角度の組み合わせ数を返します。
int lJcalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, int mode);
linfo->dthetaからphi, thetaの角度の組み合わせを算出し、planerotationAngleへ格納します。
void lPlaneRotationAngleSet(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, PlaneRotationAngle* planerotationAngle, int mode);
commonlinedataによる角度の組み合わせとPlaneRotationFileNumによる面内回転を含む角度の組み合わせをcommonlinedataWithPlaneRotationへ格納します。
void
lCommonLineDataSetInPlaneRotation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* commonlinedata,
                                  CommonLineData* commonlinedataWithPlaneRotation, int PlaneRotationNum, int CommonLineNum, int i,
                                  int* PlaneRotationFileNum, mrcImage* ref, int mode);
commonlinedataWithPlaneRotationの0 ~ PlaneRotationNum - 1までの要素にcommonlinedataの組み合わせが格納され、以降の要素に面内回転を含めた角度の組み合わせが格納されます。
Workcommonlinedataの各要素のメンバの内、angleRef, angleOhter, numをそれぞれlinfoの各要素へ格納します。
また、面内回転によって重なる画像数を返します。
int lCommonLinesDataSet(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* Workcommonlinedata, CommonLineData* commonlinedata, int mode);
コモンライン
Lの算出
double lLcalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, mrcImage* refOneLineFT, mrcImage* otherOneLineFT, mrcImage* refOneLineSino, mrcImage* otherOneLineSino, CommonLineData* commonlinedata, double delU, int Num, int mode);
linfo->ModeLによりLの算出方法を選択できます。
| linfo->ModeL | 説明 | 
|---|---|
| 0 | differential of length | 
| 1 | differential of phase | 
| 2 | addition to derivation1D (multiply) | 
| 3 | addition to derivation1D (difference) | 
linfo->ModeCalculationAreaによりLの算出範囲を設定します。
| linfo->ModeCalculationArea | 説明 | 
|---|---|
| 0 | 全ての範囲 | 
| 1 | linfo->ThresholdCalculationArea/delU以下はカット | 
CommonLineInfoから全てのコモンライン数を返します。
int
lAllCommonLineCalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, lCommonLineCalculationInfo* CommonLineInfo, int N,
                          PlaneRotationAngle* planerotationAngle, CommonLineData* Workcommonlinedata, int j, int mode);
commonlinedata[i].angleRefからコモンラインの重みを算出し、commonlinedata[i].angularweightに格納します。
void lAngularWeightCalculation(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, CommonLineData* commonlinedata, int CommonLineNum, int mode);
linfo->ModeThresholdAngularにより角度の閾値を設定できます。
| linfo->ModeThresholdAngular | 角度の閾値 | 
|---|---|
| 0 | 1.0e-4 | 
| 1 | M_PI/180 | 
| 2 | linfo->dpsi | 
1Dデータの抽出
入力in(実画像)から角度angle[radian]の成分のみを取り出し、outへ格納します。
void lmrcImageOneLineGet(mrcImage* out, mrcImage* in, float angle, int mode);
入力in(フーリエ画像)から角度angle[radian]の成分のみを取り出し、outへ格納します。
void lmrcImageFTOneLineGet(mrcImage* out, mrcImage* in, float angle, int mode);
フーリエ画像から指定した角度[radian]の成分のみを取り出します。
void
lmrcImageOneLineFTCreate(lmrcImageOrientationSearchBySimultaneousMinimizationInfo* linfo, mrcImage* ref, mrcImage* other,
                         mrcImage* refOneLineFT, mrcImage* otherOneLineFT, float RefAngle, float OtherAngle, int mode);
入力、角度、出力は下記のようになっています。
| 入力 | 角度 | 出力 | 
|---|---|---|
| ref | RefAngle | refOneLineFT | 
| other | OtherAngle | otherOneLineFT | 
相関
入力inの参照refに対する重み付き相関値を返します。OhtsuMethodによる二値化データを閾値として使用しています。
double lmrcImageOneLineSinogramCorrelationAdditionalWeight(mrcImage* in, mrcImage* ref, int mode);
modeによって相関方法を選択できます。
| mode | 相関方法 | 
|---|---|
| 2 | multiply | 
| 3 | difference |