private void checkLocalCapture() throws IOException {

		synchronized (CamServer.LockLocal) {
			try {
				if (CamServer.isLocalCapture()) {
	
					CamServer.setLocalCapture(false);
	
					BufferedImage currentImage = getCurrentImage();
	
					CamServer.logger.info(MyLogger.getLogRecord("LOCAL_CAPTURE"));
	
					ImagePlus imp2 = WindowManager.getCurrentImage();
					ImagePlus imagen = new ImagePlus("title", Toolkit
							.getDefaultToolkit().createImage(
									currentImage.getSource()));
					if (imp2 != null) {
	
						ImageStack stack = imp2.getStack();
						if (stack.getSize() == 1) {
							String label = stack.getSliceLabel(1);
							if (label != null && label.indexOf("\n") != -1)
								stack.setSliceLabel(null, 1);
							Object obj = imagen.getProperty("Label");
							if (obj != null && (obj instanceof String))
								stack.setSliceLabel((String) obj, 1);
						}
	
						stack.addSlice(null, imagen.getChannelProcessor());
						imp2.setStack(null, stack);
						imp2.setSlice(stack.getSize());
						imp2.unlock();
	
						ImageManager.getInstance().refresh();
	
					} else {
						saver.saveAsTifInZip(imagen, true);
					}
				}
			} catch (Exception e){
				if (e.getMessage().contains("Dimensions do not match")){
					// Error when trying to add a slide to the stack. The image dimensions do not match
					JOptionPane.showMessageDialog(null, 
							"No se ha podido añadir la imagen a la pila de imágenes\n" +
							"porque los tamaños son diferentes.",
							"Error al añadir imagen", JOptionPane.ERROR_MESSAGE);
				}
			}
		}
	}