bool Dataset3D::mousePick( int pickId, QVector3D pos, Qt::KeyboardModifiers modifiers, QString target ) { int paintMode = m_properties["maingl"].get( Fn::Property::D_PAINTMODE ).toInt(); if ( pickId == 0 || paintMode == 0 || !( modifiers & Qt::ControlModifier ) ) { return false; } QColor paintColorC = m_properties["maingl"].get( Fn::Property::D_PAINTCOLOR ).value<QColor>(); QVector3D paintValue; int type = m_properties["maingl"].get( Fn::Property::D_DATATYPE ).toInt(); if ( type == DT_UNSIGNED_CHAR ) { paintValue = QVector3D( paintColorC.red(), paintColorC.green(), paintColorC.blue() ); } else { paintValue = QVector3D( paintColorC.redF(), paintColorC.greenF(), paintColorC.blueF() ); } float dx = m_properties["maingl"].get( Fn::Property::D_DX ).toFloat(); float dy = m_properties["maingl"].get( Fn::Property::D_DY ).toFloat(); float dz = m_properties["maingl"].get( Fn::Property::D_DZ ).toFloat(); m_data[ getIdFromPos( pos.x(), pos.y(), pos.z() ) ] = paintValue; int brushSize = m_properties["maingl"].get( Fn::Property::D_PAINTSIZE ).toInt(); for ( int i = 0; i < brushSize; ++i ) { for ( int j = 0; j < brushSize; ++j ) { for ( int k = 0; k < brushSize; ++k ) { m_data[ getIdFromPos( pos.x() - i * dx, pos.y() - j * dy, pos.z() - k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() - i * dx, pos.y() - j * dy, pos.z() + k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() - i * dx, pos.y() + j * dy, pos.z() - k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() - i * dx, pos.y() + j * dy, pos.z() + k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() + i * dx, pos.y() - j * dy, pos.z() - k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() + i * dx, pos.y() - j * dy, pos.z() + k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() + i * dx, pos.y() + j * dy, pos.z() - k * dz ) ] = paintValue; m_data[ getIdFromPos( pos.x() + i * dx, pos.y() + j * dy, pos.z() + k * dz ) ] = paintValue; } } } glDeleteTextures( 1, &m_textureGLuint ); m_textureGLuint = 0; return true; }
QString DatasetScalar::getValueAsString( int x, int y, int z ) { float dx = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DX, 0 ) ).toFloat(); float dy = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DY, 0 ) ).toFloat(); float dz = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DZ, 0 ) ).toFloat(); x *= dx; y *= dy; z *= dz; float data = m_data[ getIdFromPos( x, y, z ) ]; return QString::number( data ); }
QString DatasetBingham::getValueAsString( int x, int y, int z ) { float dx = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DX, 0 ) ).toFloat(); float dy = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DY, 0 ) ).toFloat(); float dz = Models::g()->data( Models::g()->index( (int)Fn::Global::SLICE_DZ, 0 ) ).toFloat(); x *= dx; y *= dy; z *= dz; QVector<float> data = m_data[ getIdFromPos( x, y, z ) ]; return QString::number( data[0] ) + ", " + QString::number( data[1] ) + ", " + QString::number( data[2] ) + ", " + QString::number( data[3] ) + ", " + QString::number( data[4] ) + ", " + QString::number( data[5] ) + ", " + QString::number( data[6] ) + ", " + QString::number( data[7] ) + ", " + QString::number( data[8] ); }
QString Dataset3D::getValueAsString( float x, float y, float z ) { QVector3D data = m_data[ getIdFromPos( x, y, z ) ]; return QString::number( data.x() ) + ", " + QString::number( data.y() ) + ", " + QString::number( data.z() ); }