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

Method modify

src/IECoreImage/ChannelOp.cpp:85–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void ChannelOp::modify( Object * primitive, const CompoundObject * operands )
86{
87 ImagePrimitive *image = runTimeCast<ImagePrimitive>( primitive );
88
89 if( image->getDataWindow().isEmpty() )
90 {
91 return;
92 }
93
94 ChannelVector channels;
95
96 const vector<string> &channelNames = channelNamesParameter()->getTypedValue();
97 for( const auto &name : channelNames )
98 {
99 std::string reason;
100 if( !image->channelValid( name, &reason ) )
101 {
102 throw Exception( str( format( "Channel \"%s\" is invalid: " ) % name ) + reason );
103 }
104
105 if( !image->channels[name]->isInstanceOf( FloatVectorData::staticTypeId() ) )
106 {
107 throw Exception( str( format( "Channel \"%s\" is invalid: not a float vector." ) % name ) );
108 }
109
110 channels.push_back( boost::static_pointer_cast< FloatVectorData >( image->channels[name] ) );
111 }
112
113 modifyChannels( image->getDisplayWindow(), image->getDataWindow(), channels );
114 /// \todo Consider cases where the derived class invalidates the channel data (by changing its length)
115}

Callers

nothing calls this directly

Calls 4

channelValidMethod · 0.80
isInstanceOfMethod · 0.80
strFunction · 0.50
isEmptyMethod · 0.45

Tested by

no test coverage detected