Exemplo n.º 1
0
void PatientModelImplService::disconnectProbes()
{
	for (std::map<QString, ToolPtr>::const_iterator iter = mProbeTools.begin(); iter != mProbeTools.end(); ++iter)
	{
		ProbePtr probe = iter->second->getProbe();
		if(probe)
			disconnect(probe.get(), &Probe::videoSourceAdded, this, &PatientModelImplService::videoSourceAdded);
		else
			CX_LOG_WARNING() << "PatientModelImplService::disconnectProbes: Tool is not a probe: " << iter->second->getUid();
	}
}
Exemplo n.º 2
0
QString VLCRecorder::getVLCDefaultRecorderArguments(QString saveFile)
{
	QString defaultArguements("");
#ifdef CX_WINDOWS
	saveFile = saveFile.replace("/", "\\");
	defaultArguements = " -I luacli screen:// :screen-fps=10.000000 :live-caching=300 :sout=#transcode{vcodec=h264,acodec=none}:file{dst="+saveFile+"} :sout-keep ";
#endif
#ifdef CX_APPLE
    CX_LOG_WARNING("VLC 2.2.1 fails on Mac. VLC version 2.1.2 works.");
	defaultArguements = " -I cli screen:// \":sout=#transcode{vcodec=h264,vb=800,fps=10,scale=1,acodec=none}:duplicate{dst=standard{access=file,mux=mp4,dst="+saveFile+"}}\"";
#endif
#ifdef CX_LINUX
	defaultArguements = " -I cli screen:// :screen-fps=10.000000 :live-caching=300 \":sout=#transcode{vcodec=h264,vb=0,fps=10,scale=0,acodec=none}:file{dst="+saveFile+"}\" :sout-keep";
#endif
	return defaultArguements;
}
Exemplo n.º 3
0
void ShaderCallback::Execute(vtkObject *, unsigned long eventId, void *cbo)
{
	report_gl_error();

	vtkOpenGLHelper *OpenGLHelper = reinterpret_cast<vtkOpenGLHelper*>(cbo);

	if(!OpenGLHelper || !OpenGLHelper->VAO || !OpenGLHelper->Program)
	{
		return;
	}


	if(eventId == vtkCommand::UpdateShaderEvent)
	{
		report_gl_error();


		int textures_to_add = this->getNumberOfUploadedTextures();

		//Bind fragmentshader output variable
		// (glsl: vec4)
		if(textures_to_add != 0)
		{
			this->bindFSOutputVariable(OpenGLHelper->Program);
		}

		report_gl_error();

		//Bind VAO (Vertext Array Object - aka saved input to the vertex shader)
		OpenGLHelper->VAO->Bind();
		report_gl_error();

		for(int i=0; i< textures_to_add; ++i)
		{
			ShaderItemPtr shaderItem = mShaderItems.at(i);
			//	texture coordinates (glsl: vec3)
			vtkOpenGLBufferObjectPtr texture_coordinates = shaderItem->mTextureCoordinates;

			if(texture_coordinates)
			{
				if(!texture_coordinates->Bind())
				{
					CX_LOG_WARNING() << "Could not bind texture coordinates";
				}

				this->addArrayToAttributeArray(OpenGLHelper->Program, texture_coordinates, VS_In_Vec3_TextureCoordinate, i);
			}
			else
			{
				CX_LOG_WARNING() << "NO TEXTURE COORDINATES!";
			}

			report_gl_error();

			//	3D texture pointer (glsl: sampler3D)
			vtkTextureObjectPtr texture = shaderItem->mTexture;

			if(texture)
			{
				texture->Activate();
				this->addUniformiArray(OpenGLHelper->Program, getVectorNameFromName(FS_Uniform_3DTexture_Volume, i), texture->GetTextureUnit());
			}
			else
			{
				CX_LOG_WARNING() << "NO 3D TEXTURE!";
			}

			report_gl_error();

			//	1D texture pointer (glsl: sampler1D)
			vtkTextureObjectPtr lut = shaderItem->mLUT;

			if(lut)
			{
				lut->Activate();
				this->addUniformiArray(OpenGLHelper->Program, getVectorNameFromName(FS_Uniform_1DTexture_LUT, i), lut->GetTextureUnit());
			}
			else
			{
				CX_LOG_WARNING() << "NO 1D TEXTURE!";
			}

			report_gl_error();

			this->addUniformfArray(OpenGLHelper->Program, getVectorNameFromName(FS_Uniform_Window,i), shaderItem->mWindow);
			this->addUniformfArray(OpenGLHelper->Program, getVectorNameFromName(FS_Uniform_Level,i), shaderItem->mLevel);
			this->addUniformfArray(OpenGLHelper->Program, getVectorNameFromName(FS_Uniform_LLR,i), shaderItem->mLLR);
			this->addUniformfArray(OpenGLHelper->Program, getVectorNameFromName(FS_Uniform_Alpha,i), shaderItem->mAlpha);
		}
	}

	report_gl_error();

}
ImagePtr IGTLinkConversionSonixCXLegacy::decode(igtl::ImageMessage::Pointer message)
{
	vtkImageImportPtr imageImport = vtkImageImportPtr::New();

	// Retrive the image data
	float spacing[3]; // spacing (mm/pixel)
	int svsize[3]; // sub-volume size
	int svoffset[3]; // sub-volume offset
	int scalarType; // scalar type
	int size[3]; // image dimension

	// Note: subvolumes is not supported. Implement when needed.

	scalarType = message->GetScalarType();
	message->GetDimensions(size);
	message->GetSpacing(spacing);
	message->GetSubVolume(svsize, svoffset);
	QString deviceName = message->GetDeviceName();

	imageImport->SetNumberOfScalarComponents(1);

	switch (scalarType)
	{
	case igtl::ImageMessage::TYPE_INT8:
		CX_LOG_WARNING() << "signed char is not supported. Falling back to unsigned char.";
		imageImport->SetDataScalarTypeToUnsignedChar();
		break;
	case igtl::ImageMessage::TYPE_UINT8:
		imageImport->SetDataScalarTypeToUnsignedChar();
		break;
	case igtl::ImageMessage::TYPE_INT16:
		imageImport->SetDataScalarTypeToShort();
		break;
	case igtl::ImageMessage::TYPE_UINT16:
		imageImport->SetNumberOfScalarComponents(2);
		imageImport->SetDataScalarTypeToUnsignedChar();
		break;
	case igtl::ImageMessage::TYPE_INT32:
	case igtl::ImageMessage::TYPE_UINT32:
		imageImport->SetNumberOfScalarComponents(4);
		imageImport->SetDataScalarTypeToUnsignedChar();
		break;
	case igtl::ImageMessage::TYPE_FLOAT32:
		imageImport->SetDataScalarTypeToFloat();
		break;
	case igtl::ImageMessage::TYPE_FLOAT64:
		imageImport->SetDataScalarTypeToDouble();
		break;
	default:
		CX_LOG_WARNING() << "Unknown image type. Falling back to unsigned char.";
		imageImport->SetDataScalarTypeToUnsignedChar();
	}

	imageImport->SetDataOrigin(0, 0, 0);
	imageImport->SetDataSpacing(spacing[0], spacing[1], spacing[2]);
	imageImport->SetWholeExtent(0, size[0] - 1, 0, size[1] - 1, 0, size[2] - 1);
	imageImport->SetDataExtentToWholeExtent();
	imageImport->SetImportVoidPointer(message->GetScalarPointer());

	imageImport->Modified();
	imageImport->Update();

	ImagePtr retval(new Image(deviceName, imageImport->GetOutput()));
	IGTLinkConversionBase baseConverter;
	retval->setAcquisitionTime(baseConverter.decode_timestamp(message));
	retval = this->decode(retval);

	return retval;
}