 
 		Init << <grid_size_, block_size_ >> >(d_img_, d_img_labels_);
 
-		//Mat1i init_labels;
-		//d_img_labels_.download(init_labels);
-		// init_labels.release();
-
-		Analyze << <grid_size_, block_size_ >> > (d_img_labels_);
+		/*Mat1i init_labels;
+		d_img_labels_.download(init_labels);*/
+		//init_labels.release();
+
+		//Analyze << <grid_size_, block_size_ >> > (d_img_labels_);
+		Compression << <grid_size_, block_size_ >> > (d_img_labels_);
 
 		//Mat1i analyze_labels;
 		//d_img_labels_.download(analyze_labels);
-		// analyze_labels.release();
+		//analyze_labels.release();
 
 		Reduce << <grid_size_, block_size_ >> >(d_img_, d_img_labels_);
-		Analyze << <grid_size_, block_size_ >> > (d_img_labels_);
+		//Analyze << <grid_size_, block_size_ >> > (d_img_labels_);
+		Compression << <grid_size_, block_size_ >> > (d_img_labels_);
+
 
 		//Mat1i final_labels;
 		//d_img_labels_.download(final_labels);

					labels.data[labels_index] = labels_index + 1;
				}
			}
		}
	}


	// Analysis phase.
	// The pixel associated with current thread is given the minimum label of the neighbours.
	__global__ void Analyze(cuda::PtrStepSzi labels) {

		unsigned row = blockIdx.y * BLOCK_ROWS + threadIdx.y;
		unsigned col = blockIdx.x * BLOCK_COLS + threadIdx.x;
		unsigned labels_index = row * (labels.step / labels.elem_size) + col;

		if (row < labels.rows && col < labels.cols) {

			unsigned label = labels[labels_index];

			if (label) {								// Performances are the same as the paper variant

				unsigned index = labels_index;

				while (label - 1 != index) {
					index = label - 1;
					label = labels[index];
				}

				labels[labels_index] = label;
			}
		}
	}

		//d_img_labels_.download(init_labels);
		// init_labels.release();

		//Analyze << <grid_size_, block_size_ >> > (d_img_labels_);
		Compression << <grid_size_, block_size_ >> > (d_img_labels_);

		//Mat1i analyze_labels;
		//d_img_labels_.download(analyze_labels);
		// analyze_labels.release();

		Reduce << <grid_size_, block_size_ >> >(d_img_, d_img_labels_);
		//Analyze << <grid_size_, block_size_ >> > (d_img_labels_);
		Compression << <grid_size_, block_size_ >> > (d_img_labels_);

		//Mat1i final_labels;
		//d_img_labels_.download(final_labels);
