Fixed ComposeChannels and bugs with num_channels()

num_channels() is now a bit hacky, but necessary.  Also, the case where it is called without having an image generated first is very narrow and usually happens at most once, at initialization (when it's necessary to know, beforehand, the number of channels of the inputs, in order to construct the higher structures)

ALERT can be removed now, right?