void TransferFunctionProperty::setImageHandle(DataHandle imageHandle) { cgtAssert( imageHandle.getData() == 0 || dynamic_cast<const ImageData*>(imageHandle.getData()) != 0, "The data in the image handle must either be 0 or point to a valid ImageData object!"); if (_autoFitWindowToData && imageHandle.getData() != 0) { if (const ImageData* id = dynamic_cast<const ImageData*>(imageHandle.getData())) { const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>(); if (localRep != 0) { const Interval<float>& ii = localRep->getNormalizedIntensityRange(); _transferFunction->setIntensityDomain(cgt::vec2(ii.getLeft(), ii.getRight())); } } } _imageHandle = imageHandle; _dirtyHistogram = true; s_imageHandleChanged.emitSignal(); }
/** * Tests the concurrent access settings of the class. * * DataHandle of previously added data obtained with getData() should remains valid * even if the data in the container is replaced with new data. */ TEST_F(DataContainerTest, concurrentAccessTest) { this->_dc0->addData("data1", this->_data); DataHandle dh = this->_dc0->getData("data1"); AbstractData *someData = new ImageData(2, cgt::svec3(1,2,1), 4); this->_dc0->addData("data1", someData); EXPECT_EQ(someData, this->_dc0->getData("data1").getData()); EXPECT_NE(_data, this->_dc0->getData("data1").getData()); EXPECT_EQ(_data, dh.getData()); }