\r
import jp.nyatla.nyartoolkit.NyARException;\r
import jp.nyatla.nyartoolkit.core.raster.*;\r
-import jp.nyatla.nyartoolkit.core.types.stack.NyObjectStack;\r
-import jp.nyatla.utils.*;\r
+import jp.nyatla.nyartoolkit.core.types.stack.NyARObjectStack;\r
\r
-class RleInfoStack extends NyObjectStack<RleInfoStack.RleInfo>\r
+class RleInfoStack extends NyARObjectStack<RleInfoStack.RleInfo>\r
{\r
public class RleInfo\r
{\r
public long pos_x;\r
public long pos_y; \r
} \r
- public RleInfoStack(int i_length)\r
+ public RleInfoStack(int i_length) throws NyARException\r
{\r
super(i_length, RleInfoStack.RleInfo.class);\r
return;\r
private int _max_area;\r
private int _min_area;\r
\r
- public NyARLabeling_Rle(int i_width,int i_height)\r
+ public NyARLabeling_Rle(int i_width,int i_height) throws NyARException\r
{\r
this._rlestack=new RleInfoStack(i_width*i_height*2048/(320*240)+32);\r
this._rle1 = RleElement.createArray(i_width/2+1);\r
* @return\r
* @throws NyARException\r
*/\r
- public int labeling(NyARBinRaster i_bin_raster, int i_top, int i_bottom,RleLabelFragmentInfoStack o_stack) throws NyARException\r
+ public int labeling(NyARBinRaster i_bin_raster, int i_top, int i_bottom,NyARRleLabelFragmentInfoStack o_stack) throws NyARException\r
{\r
+ assert(i_bin_raster.isEqualBufferType(NyARBufferType.INT1D_BIN_8));\r
return this.imple_labeling(i_bin_raster,0,i_top,i_bottom,o_stack);\r
}\r
/**\r
* @return\r
* @throws NyARException\r
*/\r
- public int labeling(NyARGrayscaleRaster i_gs_raster,int i_th, int i_top, int i_bottom,RleLabelFragmentInfoStack o_stack) throws NyARException\r
+ public int labeling(NyARGrayscaleRaster i_gs_raster,int i_th, int i_top, int i_bottom,NyARRleLabelFragmentInfoStack o_stack) throws NyARException\r
{\r
+ assert(i_gs_raster.isEqualBufferType(NyARBufferType.INT1D_GRAY_8));\r
return this.imple_labeling(i_gs_raster,i_th,i_top,i_bottom,o_stack);\r
}\r
- private int imple_labeling(INyARRaster i_raster,int i_th,int i_top, int i_bottom,RleLabelFragmentInfoStack o_stack) throws NyARException\r
+ private int imple_labeling(INyARRaster i_raster,int i_th,int i_top, int i_bottom,NyARRleLabelFragmentInfoStack o_stack) throws NyARException\r
{\r
// リセット処理\r
final RleInfoStack rlestack=this._rlestack;\r
int len_prev = 0;\r
int len_current = 0;\r
final int width = i_raster.getWidth();\r
- int[] in_buf = (int[]) i_raster.getBufferReader().getBuffer();\r
+ int[] in_buf = (int[]) i_raster.getBuffer();\r
\r
int id_max = 0;\r
int label_count=0;\r
rle_current = tmp;\r
}\r
//対象のラベルだけ転写\r
- o_stack.reserv(label_count);\r
- RleLabelFragmentInfoStack.RleLabelFragmentInfo[] o_dest_array=o_stack.getArray();\r
+ o_stack.init(label_count);\r
+ NyARRleLabelFragmentInfoStack.RleLabelFragmentInfo[] o_dest_array=o_stack.getArray();\r
final int max=this._max_area;\r
final int min=this._min_area;\r
int active_labels=0;\r
}\r
//\r
final RleInfoStack.RleInfo src_info=f_array[i];\r
- final RleLabelFragmentInfoStack.RleLabelFragmentInfo dest_info=o_dest_array[active_labels];\r
+ final NyARRleLabelFragmentInfoStack.RleLabelFragmentInfo dest_info=o_dest_array[active_labels];\r
dest_info.area=area;\r
dest_info.clip_b=src_info.clip_b;\r
dest_info.clip_r=src_info.clip_r;\r