「Cluster(API)」の版間の差分
行203: | 行203: | ||
=== ログデータ === | === ログデータ === | ||
extern void clusterLogClusterInformationSet(clusterLog* cluster, clusterTypeInteger lastNum, int mode); | extern void clusterLogClusterInformationSet(clusterLog* cluster, clusterTypeInteger lastNum, int mode); | ||
− | + | modeによりログの設定範囲を設定できます。 | |
<table> | <table> | ||
<tr> | <tr> | ||
<th>mode</th> | <th>mode</th> | ||
− | <th> | + | <th>ログの設定範囲</th> |
</tr> | </tr> | ||
<tr> | <tr> | ||
行229: | 行229: | ||
extern void clusterLogClusterNumberSetForLog2(clusterLog* cluster, clusterTypeInteger lastClusterNum, int mode); | extern void clusterLogClusterNumberSetForLog2(clusterLog* cluster, clusterTypeInteger lastClusterNum, int mode); | ||
− | + | ==== ノード情報の設定 ==== | |
− | + | ログデータclusterのノード同士の関係を設定します。 | |
extern void clusterLogBelowLayerPointerSet(clusterLog* cluster, int mode); | extern void clusterLogBelowLayerPointerSet(clusterLog* cluster, int mode); | ||
− | + | ||
+ | ==== クラスターサイズの取得 ==== | ||
+ | 1データclusterから算出したクラスターサイズを返します。 | ||
extern int clusterLogClusterSizeGet(clusterLogOneRecord* cluster, int mode); | extern int clusterLogClusterSizeGet(clusterLogOneRecord* cluster, int mode); | ||
+ | |||
+ | ==== クラスターサイズの設定 ==== | ||
+ | 各クラスターサイズを算出し、clusterSizeへ格納します。 | ||
extern void clusterLogClusterSizeSet(clusterLog* cluster, int mode); | extern void clusterLogClusterSizeSet(clusterLog* cluster, int mode); | ||
+ | |||
+ | ==== 距離の取得 ==== | ||
+ | ログclusterから距離を得て戻り値のメンバdistanceへ格納します。 | ||
+ | extern clusterLogOneRecord* clusterLogGetDistance(clusterLog* cluster, clusterTypeInteger N, clusterTypeInteger M, clusterTypeInteger clusterNum, clusterTypeReal* data); | ||
+ | |||
+ | ==== bottomの取得 ==== | ||
+ | ログデータclusterのbottomを返します。 | ||
+ | extern clusterLogOneRecord* clusterLogBottomGet(clusterLog* cluster, int mode); | ||
+ | |||
+ | ==== bottomの設定 ==== | ||
+ | ログデータclusterのbottomをcluster->bottomへ格納します。 | ||
extern void clusterLogBottomSet(clusterLog* cluster, int mode); | extern void clusterLogBottomSet(clusterLog* cluster, int mode); | ||
+ | |||
+ | ==== ノードのみから全体への変換 ==== | ||
+ | ノードのみのログcluster2を変換し、全体のログとしたデータを返します。 | ||
extern clusterLog* clusterLogTransformLog2ToLog(clusterLog2* cluster2, clusterTypeInteger lastNum, int mode); | extern clusterLog* clusterLogTransformLog2ToLog(clusterLog2* cluster2, clusterTypeInteger lastNum, int mode); | ||
2015年3月16日 (月) 09:20時点における版
General/Clusterはクラスター解析におけるログのためのAPIです。
定数
バイナリログの読み書きで使用します。
#define CLUSTERLOG_BINARY_FILENAME_FORMAT "%s.%08d.%08d.%08d" #define CLUSTERLOG_BINARY_NO_CALCULATION_VALUE (-9999)
構造体
typedef float clusterTypeReal; typedef short clusterTypeInteger;
ログ(全体)
mrcImageClusterAnalysisのオプション -Logに対応したログデータの構造体です。
管理データ
リスト構造でログデータ(全体)を管理する構造体です。
typedef struct clusterLog { clusterLogOneRecord* top; clusterLogOneRecord* current; clusterLogOneRecord* bottom; } clusterLog;
ログデータ
ログデータ(全体)の構造体です。
typedef struct clusterLogOneRecord clusterLogOneRecord; struct clusterLogOneRecord { /* Information of this log line in the logfile */ clusterTypeInteger N; /* Current N (shrinked array): Definition: N > M */ clusterTypeInteger M; /* Current M : */ clusterTypeInteger prevN; /* prevN: N: the nearest pair in the below layer */ clusterTypeInteger prevM; /* prevM: M: */ clusterTypeReal distance; /* Distance between N and M */ /* Original File Number */ clusterTypeInteger originalN; clusterTypeInteger originalM; /* File Number within the below layer */ clusterTypeInteger firstN; clusterTypeInteger firstM; clusterLogOneRecord* belowLayerStart; clusterLogOneRecord* belowLayer; clusterLogOneRecord* belowLayerEnd; /* Upper Layer */ clusterLogOneRecord* upperLayer; /* Below Layer */ clusterLogOneRecord* belowLayerForN; clusterLogOneRecord* belowLayerForM; /* Including the below layer */ clusterTypeInteger clusterSize; /* File Number of the cluster */ /* This Layer */ clusterTypeInteger clusterNumber; /* Cluster Numer of this layer */ /* Set the number of the cluster where this log line attributes in a function of clusterLogClusterNumberSet or Set2 */ clusterLogOneRecord* prev; /* previous record */ clusterLogOneRecord* next; /* Next record */ };
ログ(ノードのみ)
mrcImageClusterAnalysisのオプション -Log2に対応したログデータの構造体です。
管理データ
リスト構造でログデータ(ノードのみ)を管理する構造体です。
typedef struct clusterLog2 { clusterLog2OneRecord* top; clusterLog2OneRecord* current; clusterLog2OneRecord* bottom; } clusterLog2;
ログデータ
ログデータ(ノードのみ)の構造体です。
typedef struct clusterLog2OneRecord clusterLog2OneRecord; struct clusterLog2OneRecord { // LogFile Information clusterTypeInteger N; clusterTypeInteger M; // N > M: merge N to M clusterTypeReal distance; clusterTypeReal linearCorrelation; // After reading clusterTypeInteger clusterNumber; // Cluster Number clusterLog2OneRecord* prev; clusterLog2OneRecord* next; };
樹形図
typedef struct clusterTreeInfo clusterTreeInfo; struct clusterTreeInfo { clusterTypeReal posX; clusterTypeReal posY; clusterTypeReal ShoulderScale; clusterTypeReal ArmScale; clusterTypeReal ArmOffset; clusterTypeInteger flagLog; clusterTypeInteger flagScaling; char** In; char** argv; clusterTypeReal* InPosY; clusterTypeReal* InPosX; clusterTypeInteger argc; clusterTypeInteger* clusterSize; clusterTypeInteger* clusterNumber; clusterTypeInteger currentNo; clusterTypeInteger flagFPTTreeInfo; FILE* fptTreeInfo; };
API
ファイル読み込み
ファイルからログデータを読み込み、格納されたデータのポインタを返します。
ASCIIログ(全体)
全データ
extern clusterLog* clusterLogReadAll(clusterLog* cluster, FILE* fpt, int mode);
1データ
extern clusterLogOneRecord* clusterLogRead(clusterLog* cluster, FILE* fpt, int mode);
ASCIIログ(ノードのみ)
全データ
extern clusterLog2OneRecord* clusterLog2Read(clusterLog2* cluster, FILE* fpt, int mode);
1データ
extern clusterLog2* clusterLog2ReadAll(clusterLog2* cluster, FILE* fpt, int mode);
バイナリログ
全データ
extern clusterLog* clusterLogReadAllBinary(clusterLog* cluster, char* basename, int mode);
1データ(filenameは#定数のCLUSTERLOG_BINARY_FILENAME_FORMAT(basename, prevN, prevM, N)のフォーマット)
extern clusterLogOneRecord* clusterLogReadBinary(clusterLog* cluster, clusterTypeInteger* prevN, clusterTypeInteger* prevM, char* filename, int mode);
ファイル書き出し
全てのログデータを書き出す
ASCII
extern clusterLogOneRecord* clusterLogWriteAll(clusterLog* cluster, FILE* fpt, int mode);
mrcImage
extern clusterLogOneRecord* clusterLogWriteAllBinary(clusterLog* cluster, char* basename, int mode);
バイナリ
extern clusterLogOneRecord* clusterLogWriteAllBinary2(clusterLog* cluster, FILE* fpt, int mode);
カレントのログデータを書き出す
cluster->currentのデータをファイルfptへ出力します。(clusterLogOneRecordを使用)
ASCII
extern clusterLogOneRecord* clusterLogWrite(clusterLog* cluster, FILE* fpt, int mode);
バイナリ
extern clusterLogOneRecord* clusterLogWriteBinary2(clusterLog* cluster, FILE* fpt, int mode);
指定した1データを書き出す
ASCII
clusterの1データ分のログをファイルfptへ出力します。
extern clusterLogOneRecord* clusterLogWriteOneRecord(clusterLogOneRecord* cluster, FILE* fpt, int mode);
modeにより、ログの出力フォーマットを選択できます。
mode | ログの内容 |
---|---|
0 | デフォルト(N, M, prevN, prevM, distance) |
1 | 直下のノード情報(below)を付加 |
2 | 直下の両ノード情報(belowN, belowM)を付加 |
3 | 全体から見たNo.(original)と初期設定のNo.(first)を付加 |
4 | 全てのノード情報を付加 |
バイナリ
clusterの1データ分のログをファイルfptへ出力します。
extern clusterLogOneRecord* clusterLogWriteOneRecordBinary2(clusterLogOneRecord* cluster, FILE* fpt, int mode);
modeにより、ログの出力フォーマットを選択できます。(clusterLogWriteOneRecordと同様)
ノードのみの書き出し
extern clusterLogOneRecord* clusterLogWriteClusterOnly(clusterLog* cluster, FILE* fpt, int mode);
PSファイルへの書き出し
extern void clusterLogWritePS(clusterLog* cluster, clusterTreeInfo* linfo, FILE* fpt, int mode);
ログデータ
extern void clusterLogClusterInformationSet(clusterLog* cluster, clusterTypeInteger lastNum, int mode);
modeによりログの設定範囲を設定できます。
mode | ログの設定範囲 |
---|---|
0 | 全体 |
1 | ノードのみ |
ログ(全体)
ノードの場合
extern void clusterLogClusterNumberSet(clusterLogOneRecord* bottom, clusterTypeInteger lastClusterNum, int mode);
末端の場合
extern void clusterLogClusterNumberSet2(clusterLog* top, clusterTypeInteger firstClusterNum, int mode);
ログ(ノードのみ)
extern void clusterLogClusterNumberSetForLog2(clusterLog* cluster, clusterTypeInteger lastClusterNum, int mode);
ノード情報の設定
ログデータclusterのノード同士の関係を設定します。
extern void clusterLogBelowLayerPointerSet(clusterLog* cluster, int mode);
クラスターサイズの取得
1データclusterから算出したクラスターサイズを返します。
extern int clusterLogClusterSizeGet(clusterLogOneRecord* cluster, int mode);
クラスターサイズの設定
各クラスターサイズを算出し、clusterSizeへ格納します。
extern void clusterLogClusterSizeSet(clusterLog* cluster, int mode);
距離の取得
ログclusterから距離を得て戻り値のメンバdistanceへ格納します。
extern clusterLogOneRecord* clusterLogGetDistance(clusterLog* cluster, clusterTypeInteger N, clusterTypeInteger M, clusterTypeInteger clusterNum, clusterTypeReal* data);
bottomの取得
ログデータclusterのbottomを返します。
extern clusterLogOneRecord* clusterLogBottomGet(clusterLog* cluster, int mode);
bottomの設定
ログデータclusterのbottomをcluster->bottomへ格納します。
extern void clusterLogBottomSet(clusterLog* cluster, int mode);
ノードのみから全体への変換
ノードのみのログcluster2を変換し、全体のログとしたデータを返します。
extern clusterLog* clusterLogTransformLog2ToLog(clusterLog2* cluster2, clusterTypeInteger lastNum, int mode);
初期化
ログ(全体)
extern clusterLog* clusterLogInit(clusterLog * cluster, int mode); extern clusterLogOneRecord* clusterLogInitOneRecord(clusterLogOneRecord * cluster, int mode);
ログ(ノードのみ)
extern clusterLog2* clusterLog2Init(clusterLog2 * cluster, int mode); extern clusterLog2OneRecord* clusterLog2InitOneRecord(clusterLog2OneRecord * cluster, int mode);