本文整理汇总了C++中pixelType函数的典型用法代码示例。如果您正苦于以下问题:C++ pixelType函数的具体用法?C++ pixelType怎么用?C++ pixelType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pixelType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fromFile
bool QGLPixmapData::fromFile(const QString &filename, const char *format,
Qt::ImageConversionFlags flags)
{
if (pixelType() == QPixmapData::BitmapType)
return QPixmapData::fromFile(filename, format, flags);
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
return false;
QByteArray data = file.peek(64);
bool alpha;
if (m_texture.canBindCompressedTexture
(data.constData(), data.size(), format, &alpha)) {
resize(0, 0);
data = file.readAll();
file.close();
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture
(data.constData(), data.size(), format);
if (!size.isEmpty()) {
w = size.width();
h = size.height();
is_null = false;
d = 32;
m_hasAlpha = alpha;
m_source = QImage();
m_dirty = isValid();
return true;
}
return false;
}
fromImage(QImageReader(&file, format).read(), flags);
return !isNull();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:33,代码来源:qpixmapdata_gl.cpp
示例2: pixelType
void QGLPixmapData::resize(int width, int height)
{
if (width == w && height == h)
return;
if (width <= 0 || height <= 0) {
width = 0;
height = 0;
}
w = width;
h = height;
is_null = (w <= 0 || h <= 0);
d = pixelType() == QPixmapData::PixmapType ? 32 : 1;
if (m_texture.id) {
QGLShareContextScope ctx(qt_gl_share_context());
glDeleteTextures(1, &m_texture.id);
m_texture.id = 0;
}
m_source = QImage();
m_dirty = isValid();
setSerialNumber(++qt_gl_pixmap_serial);
}
开发者ID:RS102839,项目名称:qt,代码行数:25,代码来源:qpixmapdata_gl.cpp
示例3: setSerialNumber
void QMacPixmapData::resize(int width, int height)
{
setSerialNumber(++qt_pixmap_serial);
w = width;
h = height;
is_null = (w <= 0 || h <= 0);
d = (pixelType() == BitmapType ? 1 : 32);
bool make_null = w <= 0 || h <= 0; // create null pixmap
if (make_null || d == 0) {
w = 0;
h = 0;
is_null = true;
d = 0;
if (!make_null)
qWarning("Qt: QPixmap: Invalid pixmap parameters");
return;
}
if (w < 1 || h < 1)
return;
//create the pixels
bytesPerRow = w * sizeof(quint32); // Minimum bytes per row.
// Quartz2D likes things as a multple of 16 (for now).
bytesPerRow = COMPTUE_BEST_BYTES_PER_ROW(bytesPerRow);
macCreatePixels();
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:29,代码来源:qpixmap_mac.cpp
示例4: TRACE
void QEglGLPixmapData::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
{
TRACE();
resize(image.width(), image.height());
if (pixelType() == BitmapType) {
m_source = image.convertToFormat(QImage::Format_MonoLSB);
} else {
QImage::Format format = QImage::Format_RGB32;
if (qApp->desktop()->depth() == 16)
format = QImage::Format_RGB16;
if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels())
format = QImage::Format_ARGB32_Premultiplied;;
m_source = image.convertToFormat(format);
}
m_dirty = true;
m_hasFillColor = false;
m_hasAlpha = m_source.hasAlphaChannel();
w = image.width();
h = image.height();
is_null = (w <= 0 || h <= 0);
d = m_source.depth();
if (m_texture.id) {
QGLShareContextScope ctx(qt_gl_share_widget()->context());
glDeleteTextures(1, &m_texture.id);
m_texture.id = 0;
}
}
开发者ID:RS102839,项目名称:qt,代码行数:34,代码来源:qpixmapdata_egl_p.cpp
示例5: defined
void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
{
if (type == QPixmapData::SgImage && pixmap) {
#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap);
m_sgImage = new RSgImage;
m_sgImage->Open(sgImage->Id());
TSgImageInfo info;
sgImage->GetInfo(info);
w = info.iSizeInPixels.iWidth;
h = info.iSizeInPixels.iHeight;
d = symbianPixeFormatBitsPerPixel((TUidPixelFormat)info.iPixelFormat);
m_source = QVolatileImage();
m_hasAlpha = true;
m_hasFillColor = false;
m_dirty = true;
is_null = (w <= 0 || h <= 0);
#endif
} else if (type == QPixmapData::FbsBitmap && pixmap) {
CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap);
QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
if (size.width() == w && size.height() == h)
setSerialNumber(++qt_gl_pixmap_serial);
resize(size.width(), size.height());
m_source = QVolatileImage(bitmap);
if (pixelType() == BitmapType) {
m_source.ensureFormat(QImage::Format_MonoLSB);
} else if (!knownGoodFormat(m_source.format())) {
m_source.beginDataAccess();
QImage::Format format = idealFormat(m_source.imageRef(), Qt::AutoColor);
m_source.endDataAccess(true);
m_source.ensureFormat(format);
}
m_hasAlpha = m_source.hasAlphaChannel();
m_hasFillColor = false;
m_dirty = true;
d = m_source.depth();
} else if (type == QPixmapData::VolatileImage && pixmap) {
// Support QS60Style in more efficient skin graphics retrieval.
QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);
if (img->width() == w && img->height() == h)
setSerialNumber(++qt_gl_pixmap_serial);
resize(img->width(), img->height());
m_source = *img;
m_hasAlpha = m_source.hasAlphaChannel();
m_hasFillColor = false;
m_dirty = true;
d = m_source.depth();
} else if (type == QPixmapData::NativeImageHandleProvider && pixmap) {
destroyTexture();
nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap);
// Cannot defer the retrieval, we need at least the size right away.
createFromNativeImageHandleProvider();
}
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:59,代码来源:qpixmapdata_symbiangl.cpp
示例6: CubeIoHandler
/**
* Construct a tile handler. This will determine a good chunk size to put
* into the output cube.
*
* @param dataFile The file with cube DN data in it
* @param virtualBandList The mapping from virtual band to physical band, see
* CubeIoHandler's description.
* @param labels The Pvl labels for the cube
* @param alreadyOnDisk True if the cube is allocated on the disk, false
* otherwise
*/
CubeTileHandler::CubeTileHandler(QFile * dataFile,
const QList<int> *virtualBandList, const Pvl &labels, bool alreadyOnDisk)
: CubeIoHandler(dataFile, virtualBandList, labels, alreadyOnDisk) {
const PvlObject &core = labels.findObject("IsisCube").findObject("Core");
if(core.hasKeyword("Format")) {
setChunkSizes(core["TileSamples"], core["TileLines"], 1);
}
else {
// up to 1MB chunks
int sampleChunkSize =
findGoodSize(512 * 4 / SizeOf(pixelType()), sampleCount());
int lineChunkSize =
findGoodSize(512 * 4 / SizeOf(pixelType()), lineCount());
setChunkSizes(sampleChunkSize, lineChunkSize, 1);
}
}
开发者ID:corburn,项目名称:ISIS,代码行数:30,代码来源:CubeTileHandler.cpp
示例7: QImage
void QRasterPlatformPixmap::resize(int width, int height)
{
QImage::Format format;
if (pixelType() == BitmapType)
format = QImage::Format_MonoLSB;
else
format = QNativeImage::systemFormat();
image = QImage(width, height, format);
w = width;
h = height;
d = image.depth();
is_null = (w <= 0 || h <= 0);
if (pixelType() == BitmapType && !image.isNull()) {
image.setColorCount(2);
image.setColor(0, QColor(Qt::color0).rgba());
image.setColor(1, QColor(Qt::color1).rgba());
}
setSerialNumber(image.cacheKey() >> 32);
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:22,代码来源:qpixmap_raster.cpp
示例8: QDirectFBPixmapData
QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
Qt::TransformationMode mode) const
{
if (!surface || transform.type() != QTransform::TxScale
|| mode != Qt::FastTransformation)
{
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
const QImage *image = that->buffer();
if (image) { // avoid deep copy
const QImage transformed = image->transformed(transform, mode);
that->unlockDirectFB();
QDirectFBPixmapData *data = new QDirectFBPixmapData(pixelType());
data->fromImage(transformed, Qt::AutoColor);
return QPixmap(data);
}
return QPixmapData::transformed(transform, mode);
}
int w, h;
surface->GetSize(surface, &w, &h);
const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
if (size.isEmpty())
return QPixmap();
QDirectFBPixmapData *data = new QDirectFBPixmapData(pixelType());
data->resize(size.width(), size.height());
IDirectFBSurface *dest = data->surface;
dest->SetBlittingFlags(dest, DSBLIT_NOFX);
const DFBRectangle srcRect = { 0, 0, w, h };
const DFBRectangle destRect = { 0, 0, size.width(), size.height() };
dest->StretchBlit(dest, surface, &srcRect, &destRect);
return QPixmap(data);
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:37,代码来源:qdirectfbpixmap.cpp
示例9: conversion
/*!
out-of-place conversion (inPlace == false) will always detach()
*/
void QGLPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace)
{
if (image.size() == QSize(w, h))
setSerialNumber(++qt_gl_pixmap_serial);
resize(image.width(), image.height());
if (pixelType() == BitmapType) {
m_source = image.convertToFormat(QImage::Format_MonoLSB);
} else {
QImage::Format format = QImage::Format_RGB32;
if (qApp->desktop()->depth() == 16)
format = QImage::Format_RGB16;
if (image.hasAlphaChannel()
&& ((flags & Qt::NoOpaqueDetection)
|| const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()))
format = QImage::Format_ARGB32_Premultiplied;;
if (inPlace && image.data_ptr()->convertInPlace(format, flags)) {
m_source = image;
} else {
m_source = image.convertToFormat(format);
// convertToFormat won't detach the image if format stays the same.
if (image.format() == format)
m_source.detach();
}
}
m_dirty = true;
m_hasFillColor = false;
m_hasAlpha = m_source.hasAlphaChannel();
w = image.width();
h = image.height();
is_null = (w <= 0 || h <= 0);
d = m_source.depth();
if (m_texture.id) {
QGLShareContextScope ctx(qt_gl_share_context());
glDeleteTextures(1, &m_texture.id);
m_texture.id = 0;
}
}
开发者ID:RS102839,项目名称:qt,代码行数:49,代码来源:qpixmapdata_gl.cpp
示例10: pixelType
mitk::DataNode::Pointer mitk::Tool::CreateEmptySegmentationNode( Image* original, const std::string& organName, const mitk::Color& color )
{
// we NEED a reference image for size etc.
if (!original) return NULL;
// actually create a new empty segmentation
PixelType pixelType(mitk::MakeScalarPixelType<DefaultSegmentationDataType>() );
Image::Pointer segmentation = Image::New();
if (original->GetDimension() == 2)
{
const unsigned int dimensions[] = { original->GetDimension(0), original->GetDimension(1), 1 };
segmentation->Initialize(pixelType, 3, dimensions);
}
else
{
segmentation->Initialize(pixelType, original->GetDimension(), original->GetDimensions());
}
unsigned int byteSize = sizeof(DefaultSegmentationDataType);
for (unsigned int dim = 0; dim < segmentation->GetDimension(); ++dim)
{
byteSize *= segmentation->GetDimension(dim);
}
memset( segmentation->GetData(), 0, byteSize );
if (original->GetTimeSlicedGeometry() )
{
AffineGeometryFrame3D::Pointer originalGeometryAGF = original->GetTimeSlicedGeometry()->Clone();
TimeSlicedGeometry::Pointer originalGeometry = dynamic_cast<TimeSlicedGeometry*>( originalGeometryAGF.GetPointer() );
segmentation->SetGeometry( originalGeometry );
}
else
{
Tool::ErrorMessage("Original image does not have a 'Time sliced geometry'! Cannot create a segmentation.");
return NULL;
}
return CreateSegmentationNode( segmentation, organName, color );
}
开发者ID:beneon,项目名称:MITK,代码行数:40,代码来源:mitkTool.cpp
示例11: CastToItkImage
void mitk::CorrectorAlgorithm::ItkCalculateDifferenceImage( itk::Image<TPixel, VImageDimension>* originalImage, Image* modifiedMITKImage )
{
typedef itk::Image<ipMITKSegmentationTYPE, VImageDimension> ModifiedImageType;
typedef itk::Image<short signed int, VImageDimension> DiffImageType;
typedef itk::ImageRegionConstIterator< itk::Image<TPixel,VImageDimension> > OriginalSliceIteratorType;
typedef itk::ImageRegionConstIterator< ModifiedImageType > ModifiedSliceIteratorType;
typedef itk::ImageRegionIterator< DiffImageType > DiffSliceIteratorType;
typename ModifiedImageType::Pointer modifiedImage;
CastToItkImage( modifiedMITKImage, modifiedImage );
// create new image as a copy of the input
// this new image is the output of this filter class
typename DiffImageType::Pointer diffImage;
m_DifferenceImage = Image::New();
PixelType pixelType( typeid(short signed int) );
m_DifferenceImage->Initialize( pixelType, 2, modifiedMITKImage->GetDimensions() );
CastToItkImage( m_DifferenceImage, diffImage );
// iterators over both input images (original and modified) and the output image (diff)
ModifiedSliceIteratorType modifiedIterator( modifiedImage, diffImage->GetLargestPossibleRegion() );
OriginalSliceIteratorType originalIterator( originalImage, diffImage->GetLargestPossibleRegion() );
DiffSliceIteratorType diffIterator( diffImage, diffImage->GetLargestPossibleRegion() );
modifiedIterator.GoToBegin();
originalIterator.GoToBegin();
diffIterator.GoToBegin();
while ( !diffIterator.IsAtEnd() )
{
short signed int difference = static_cast<short signed int>( static_cast<signed int>(modifiedIterator.Get()) -
static_cast<signed int>(originalIterator.Get())); // not good for bigger values ?!
diffIterator.Set( difference );
++modifiedIterator;
++originalIterator;
++diffIterator;
}
}
开发者ID:david-guerrero,项目名称:MITK,代码行数:39,代码来源:mitkCorrectorAlgorithm.cpp
示例12: fillImage
QImage QGLPixmapData::fillImage(const QColor &color) const
{
QImage img;
if (pixelType() == BitmapType) {
img = QImage(w, h, QImage::Format_MonoLSB);
img.setColorCount(2);
img.setColor(0, QColor(Qt::color0).rgba());
img.setColor(1, QColor(Qt::color1).rgba());
if (color == Qt::color1)
img.fill(1);
else
img.fill(0);
} else {
img = QImage(w, h,
m_hasAlpha
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32);
img.fill(PREMUL(color.rgba()));
}
return img;
}
开发者ID:RS102839,项目名称:qt,代码行数:23,代码来源:qpixmapdata_gl.cpp
示例13: switch
void mitk::OverwriteSliceImageFilter::GenerateData()
{
//
// this is the place to implement the major part of undo functionality (bug #491)
// here we have to create undo/do operations
//
// WHO is the operation actor? This object may not be destroyed ever (design of undo stack)!
// -> some singleton method of this filter?
//
// neccessary additional objects:
// - something that executes the operations
// - the operation class (must hold a binary diff or something)
// - observer commands to know when the image is deleted (no further action then, perhaps even remove the operations from the undo stack)
//
Image::ConstPointer input = ImageToImageFilter::GetInput(0);
Image::ConstPointer input3D = input;
Image::ConstPointer slice = m_SliceImage;
if ( input.IsNull() || slice.IsNull() ) return;
switch (m_SliceDimension)
{
default:
case 2:
m_Dimension0 = 0;
m_Dimension1 = 1;
break;
case 1:
m_Dimension0 = 0;
m_Dimension1 = 2;
break;
case 0:
m_Dimension0 = 1;
m_Dimension1 = 2;
break;
}
if ( slice->GetDimension() < 2 || input->GetDimension() > 4 ||
slice->GetDimension(0) != input->GetDimension(m_Dimension0) ||
slice->GetDimension(1) != input->GetDimension(m_Dimension1) ||
m_SliceIndex >= input->GetDimension(m_SliceDimension)
)
{
itkExceptionMacro("Slice and image dimensions differ or slice index is too large. Sorry, cannot work like this.");
return;
}
if ( input->GetDimension() == 4 )
{
ImageTimeSelector::Pointer timeSelector = ImageTimeSelector::New();
timeSelector->SetInput( input );
timeSelector->SetTimeNr( m_TimeStep );
timeSelector->UpdateLargestPossibleRegion();
input3D = timeSelector->GetOutput();
}
if ( m_SliceDifferenceImage.IsNull() ||
m_SliceDifferenceImage->GetDimension(0) != m_SliceImage->GetDimension(0) ||
m_SliceDifferenceImage->GetDimension(1) != m_SliceImage->GetDimension(1) )
{
m_SliceDifferenceImage = mitk::Image::New();
mitk::PixelType pixelType( mitk::MakeScalarPixelType<short signed int>() );
m_SliceDifferenceImage->Initialize( pixelType, 2, m_SliceImage->GetDimensions() );
}
//MITK_INFO << "Overwriting slice " << m_SliceIndex << " in dimension " << m_SliceDimension << " at time step " << m_TimeStep << std::endl;
// this will do a long long if/else to find out both pixel types
AccessFixedDimensionByItk( input3D, ItkImageSwitch, 3 );
SegmentationInterpolationController* interpolator = SegmentationInterpolationController::InterpolatorForImage( input );
if (interpolator)
{
interpolator->BlockModified(true);
interpolator->SetChangedSlice( m_SliceDifferenceImage, m_SliceDimension, m_SliceIndex, m_TimeStep );
}
if ( m_CreateUndoInformation )
{
// create do/undo operations (we don't execute the doOp here, because it has already been executed during calculation of the diff image
ApplyDiffImageOperation* doOp = new ApplyDiffImageOperation( OpTEST, const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, m_SliceDimension, m_SliceIndex );
ApplyDiffImageOperation* undoOp = new ApplyDiffImageOperation( OpTEST, const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, m_SliceDimension, m_SliceIndex );
undoOp->SetFactor( -1.0 );
OperationEvent* undoStackItem = new OperationEvent( DiffImageApplier::GetInstanceForUndo(), doOp, undoOp, this->EventDescription(m_SliceDimension, m_SliceIndex, m_TimeStep) );
UndoController::GetCurrentUndoModel()->SetOperationEvent( undoStackItem );
}
// this image is modified (good to know for the renderer)
input->Modified();
if (interpolator)
{
interpolator->BlockModified(false);
}
}
开发者ID:beneon,项目名称:MITK,代码行数:95,代码来源:mitkOverwriteSliceImageFilter.cpp
示例14: MUCam_setBitCount
/**
* Handles "PixelType" property.
*/
int MUCamSource::OnPixelType(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::AfterSet)
{
string val;
pProp->Get(val);
if (val.compare(g_PixelType_8bit) == 0)
{
MUCam_setBitCount(hCameras_[currentCam_], 8);
bytesPerPixel_ = 1;
bitCnt_ = 8;
}
else if (val.compare(g_PixelType_16bit) == 0)
{
MUCam_setBitCount(hCameras_[currentCam_], 16);
bytesPerPixel_ = 2;
bitCnt_ = 16;
}
else if (val.compare(g_PixelType_32bitRGB) == 0)
{
MUCam_setBitCount(hCameras_[currentCam_], 8);
bytesPerPixel_ = 4;
bitCnt_ = 24;
}
else if (val.compare(g_PixelType_64bitRGB) == 0)
{
MUCam_setBitCount(hCameras_[currentCam_], 16);
bytesPerPixel_ = 8;
bitCnt_ = 48;
}
else
assert(false);
////////////////////////////////
////////////////////////////////////////////////////////////////////////
char buf[MM::MaxStrLength];
GetProperty(MM::g_Keyword_PixelType, buf);
std::string pixelType(buf);
if (pixelType.compare(g_PixelType_8bit) == 0)
{
if(bytesPerPixel_ == 2)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_16bit);
}
else if(bytesPerPixel_ == 4)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_32bitRGB);
}
else if(bytesPerPixel_ == 8)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_64bitRGB);
}
}
else if (pixelType.compare(g_PixelType_16bit) == 0)
{
if(bytesPerPixel_ == 1)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_8bit);
}
else if(bytesPerPixel_ == 4)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_32bitRGB);
}
else if(bytesPerPixel_ == 8)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_64bitRGB);
}
}
else if (pixelType.compare(g_PixelType_32bitRGB) == 0)
{
if(bytesPerPixel_ == 1)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_8bit);
}
else if(bytesPerPixel_ == 2)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_16bit);
}
else if(bytesPerPixel_ == 8)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_64bitRGB);
}
}
else if (pixelType.compare(g_PixelType_64bitRGB) == 0)
{
if(bytesPerPixel_ == 1)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_8bit);
}
else if(bytesPerPixel_ == 2)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_16bit);
}
else if(bytesPerPixel_ == 4)
{
SetProperty(MM::g_Keyword_PixelType, g_PixelType_32bitRGB);
//.........这里部分代码省略.........
开发者ID:PI-SRau,项目名称:micro-manager,代码行数:101,代码来源:MUCamSource.cpp
示例15: QMacPixmapData
QPixmapData *QMacPixmapData::createCompatiblePixmapData() const
{
return new QMacPixmapData(pixelType());
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:4,代码来源:qpixmap_mac.cpp
示例16: qWarning
QPixmapData *QMeeGoLivePixmapData::createCompatiblePixmapData() const
{
qWarning("Create compatible called on live pixmap! Expect fail soon...");
return new QMeeGoRasterPixmapData(pixelType());
}
开发者ID:wpbest,项目名称:copperspice,代码行数:5,代码来源:qmeegolivepixmapdata.cpp
示例17: pixelType
void mitk::Image::Initialize(vtkImageData* vtkimagedata, int channels, int tDim, int sDim, int pDim)
{
if(vtkimagedata==nullptr) return;
m_Dimension=vtkimagedata->GetDataDimension();
unsigned int i, *tmpDimensions=new unsigned int[m_Dimension>4?m_Dimension:4];
for(i=0;i<m_Dimension;++i) tmpDimensions[i]=vtkimagedata->GetDimensions()[i];
if(m_Dimension<4)
{
unsigned int *p;
for(i=0,p=tmpDimensions+m_Dimension;i<4-m_Dimension;++i, ++p)
*p=1;
}
if(pDim>=0)
{
tmpDimensions[1]=pDim;
if(m_Dimension < 2)
m_Dimension = 2;
}
if(sDim>=0)
{
tmpDimensions[2]=sDim;
if(m_Dimension < 3)
m_Dimension = 3;
}
if(tDim>=0)
{
tmpDimensions[3]=tDim;
if(m_Dimension < 4)
m_Dimension = 4;
}
mitk::PixelType pixelType(MakePixelType(vtkimagedata));
Initialize(pixelType, m_Dimension, tmpDimensions, channels);
const double *spacinglist = vtkimagedata->GetSpacing();
Vector3D spacing;
FillVector3D(spacing, spacinglist[0], 1.0, 1.0);
if(m_Dimension>=2)
spacing[1]=spacinglist[1];
if(m_Dimension>=3)
spacing[2]=spacinglist[2];
// access origin of vtkImage
Point3D origin;
double vtkorigin[3];
vtkimagedata->GetOrigin(vtkorigin);
FillVector3D(origin, vtkorigin[0], 0.0, 0.0);
if(m_Dimension>=2)
origin[1]=vtkorigin[1];
if(m_Dimension>=3)
origin[2]=vtkorigin[2];
SlicedGeometry3D* slicedGeometry = GetSlicedGeometry(0);
// re-initialize PlaneGeometry with origin and direction
PlaneGeometry* planeGeometry = static_cast<PlaneGeometry*>(slicedGeometry->GetPlaneGeometry(0));
planeGeometry->SetOrigin(origin);
// re-initialize SlicedGeometry3D
slicedGeometry->SetOrigin(origin);
slicedGeometry->SetSpacing(spacing);
ProportionalTimeGeometry::Pointer timeGeometry = ProportionalTimeGeometry::New();
timeGeometry->Initialize(slicedGeometry, m_Dimensions[3]);
SetTimeGeometry(timeGeometry);
delete [] tmpDimensions;
}
开发者ID:0r,项目名称:MITK,代码行数:70,代码来源:mitkImage.cpp
示例18: createPixmapForImage
void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace)
{
QImage::Format format;
if (flags & Qt::NoFormatConversion)
format = sourceImage.format();
else
if (pixelType() == BitmapType) {
format = QImage::Format_MonoLSB;
} else {
if (sourceImage.depth() == 1) {
format = sourceImage.hasAlphaChannel()
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32;
} else {
QImage::Format opaqueFormat = QNativeImage::systemFormat();
QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
#if !defined(__ARM_NEON__) && !defined(__SSE2__)
switch (opaqueFormat) {
case QImage::Format_RGB16:
alphaFormat = QImage::Format_ARGB8565_Premultiplied;
break;
default: // We don't care about the others...
break;
}
#endif
if (!sourceImage.hasAlphaChannel()) {
format = opaqueFormat;
} else if ((flags & Qt::NoOpaqueDetection) == 0
&& !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
{
format = opaqueFormat;
} else {
format = alphaFormat;
}
}
}
// image has alpha format but is really opaque, so try to do a
// more efficient conversion
if (format == QImage::Format_RGB32 && (sourceImage.format() == QImage::Format_ARGB32
|| sourceImage.format() == QImage::Format_ARGB32_Premultiplied))
{
image = sourceImage;
if (!inPlace)
image.detach();
if (image.d)
image.d->format = QImage::Format_RGB32;
} else if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
image = sourceImage;
} else {
image = sourceImage.convertToFormat(format);
}
if (image.d) {
w = image.d->width;
h = image.d->height;
d = image.d->depth;
} else {
w = h = d = 0;
}
is_null = (w <= 0 || h <= 0);
image.d->devicePixelRatio = sourceImage.devicePixelRatio();
//ensure the pixmap and the image resulting from toImage() have the same cacheKey();
setSerialNumber(image.cacheKey() >> 32);
setDetachNumber(image.d->detach_no);
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:69,代码来源:qpixmap_raster.cpp
示例19: QMeeGoRasterPixmapData
QPixmapData *QMeeGoPixmapData::createCompatiblePixmapData() const
{
return new QMeeGoRasterPixmapData(pixelType());
}
开发者ID:stephaneAG,项目名称:PengPod700,代码行数:4,代码来源:qmeegopixmapdata.cpp
示例20:
QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const
{
QPlatformPixmap *d = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(pixelType());
return d;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:5,代码来源:qplatformpixmap.cpp
注:本文中的pixelType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论