• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamepythonphpguiwindowsc翻訳omegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

コミットメタ情報

リビジョン3 (tree)
日時2016-10-01 06:56:19
作者kmorimatsu

ログメッセージ

KM_DNA_Length_Measurement ver 1.200

変更サマリ

差分

--- branches/kmDNAlengthMeasurement/KM_DNA_Length_Measurement.java (revision 2)
+++ branches/kmDNAlengthMeasurement/KM_DNA_Length_Measurement.java (revision 3)
@@ -1,7 +1,7 @@
11 /*******************************************
22 * Image J DNA length measurement plugin *
33 * Constructed by Katsumi and Ichiro *
4- * KM_DNA_Length Measurement ver 1.1 *
4+ * KM_DNA_Length Measurement ver 1.2 *
55 *******************************************/
66 import ij.*;
77 import ij.process.*;
@@ -38,6 +38,8 @@
3838 double imageRoiLeft,imageRoiRight,imageRoiUp,imageRoiBottom;
3939 double imageRoiLineWidth, imageRoiLeftX, imageRoiLeftY, imageRoiAngle, imageRoiLength;
4040 double imageRoiRightX, imageRoiRightY;
41+ // For debugging
42+ String log="";
4143
4244 public void run(String arg)
4345 {
@@ -106,6 +108,7 @@
106108 /* For each stacks in image file */
107109 for (int stack_num = 0; stack_num < stack_size; stack_num++)
108110 {
111+ //IJ.log("stack_num:"+stack_num);
109112 // Show the current slice of image to be analyzed
110113 img_plus.setSlice(stack_num + 1);
111114
@@ -127,20 +130,28 @@
127130
128131 /* If ROI exists, pick up a contour that overlap to this ROI */
129132 int roi_hi_score=0;
133+ int roi_hi_pos=0;
134+ //String scores="";
135+ //log="stack_num:"+stack_num+" contours:"+contours.size();
130136 if (imageRoi!=null) {
131137 // Check the scores to fit to ROI, and store the maximum case as contour[0]
132138 for (int i=0;i<contours.size(); i++) {
133139 int j=roiScore(contours.get(i));
140+ //scores=scores+" "+j;
134141 if (roi_hi_score<=j) {
135142 roi_hi_score=j;
136- contours.set(0,contours.get(i));
143+ //contours.set(0,contours.get(i));
144+ roi_hi_pos=i;
137145 }
138146 }
147+ if (0<roi_hi_pos) contours.set(0,contours.get(roi_hi_pos));
139148 // contours array-list will have only one contour
140149 while (1<contours.size()) {
141150 contours.remove(contours.size()-1);
142151 }
143152 }
153+ //log=log+" scores:"+scores;
154+ //IJ.log(log);
144155
145156 // org.opencv.core.Point
146157 ArrayList<Point> right_pts = new ArrayList<Point>();
@@ -178,7 +189,7 @@
178189 stack.addSlice("", data);
179190 writeResults(stack_num, left_pts, right_pts, distances);
180191 }
181- rt.show("DNA Length");
192+ rt.show("DNA Length ver 1.2");
182193 (new ImagePlus("Pattern Recognition", stack)).show();
183194 }
184195
@@ -230,6 +241,11 @@
230241 Collections.sort(list_contour, ComparatorX());
231242 double up=getMinY(list_contour);
232243 double bottom=getMaxY(list_contour);
244+ // If contour is too large, ignore.
245+ //IJ.log(">"+right+" "+left+" "+bottom+" "+up);
246+ if (0.5*w*h<(right-left)*(bottom-up)) return 0;
247+ // If contour is a line, ignore.
248+ if (left==right || up==bottom) return 0;
233249 // If either of verticles in each is in the rectangle of other, increment score.
234250 if (left<=imageRoiLeft && imageRoiLeft<=right && up<=imageRoiUp && imageRoiUp <= bottom) score++;
235251 if (left<=imageRoiRight && imageRoiRight<=right && up<=imageRoiUp && imageRoiUp <= bottom) score++;