MCPcopy Create free account
hub / github.com/ImageEngine/cortex / channelValid

Method channelValid

src/IECoreImage/ImagePrimitive.cpp:383–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383bool ImagePrimitive::channelValid( const IECore::Data *data, std::string *reason ) const
384{
385 if( !data )
386 {
387 if( reason )
388 {
389 *reason = "Channel has no data.";
390 }
391 return false;
392 }
393
394 if( !trait<TypeTraits::IsNumericVectorTypedData>( data ) )
395 {
396 if( reason )
397 {
398 *reason = "Channel data has inappropriate type.";
399 }
400 return false;
401 }
402
403 size_t size = IECore::size( data );
404 size_t numPixels = channelSize();
405 if( size!=numPixels )
406 {
407 if( reason )
408 {
409 *reason = str( format( "Channel has wrong size (%d but should be %d)." ) % size % numPixels );
410 }
411 return false;
412 }
413
414 return true;
415}
416
417bool ImagePrimitive::channelValid( const std::string &name, std::string *reason ) const
418{

Callers 14

testChannelValidMethod · 0.95
testImagesMethod · 0.80
testWholeImageMethod · 0.80
modifyMethod · 0.80
modifyMethod · 0.80
doOperationMethod · 0.80
modifyMethod · 0.80
LuminanceTextureMethod · 0.80
doConversionMethod · 0.80
AlphaTextureMethod · 0.80
doConversionMethod · 0.80
channelValidFunction · 0.80

Calls 5

channelValidFunction · 0.85
strFunction · 0.50
findMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by 3

testChannelValidMethod · 0.76
testImagesMethod · 0.64
testWholeImageMethod · 0.64