I just noticed that the image source metadata was lost after the image goes through the image-normalizer node.
Do you observe the same ?
Yes, that should be the case for most of the nodes that change images. In this particular case, you can use the Transfer Image Metadata node to transfer the source to the normalized image since e.g. dimensionality hasn’t changed. If that should be the case, it’s also possible to do this manually with the Set Image Metadata node.
Hi Stefan, thanks for the reply.
I get the idea that if the node makes changes to the image it’s not the same source file anymore.
But some other nodes that also change the image (e.g. Gaussian Convolution) actually preserve the metadata
So from what you say the expected behaviour is rather to strip the metadata for nodes that modify the pixel information right ?
Hmm, good point. The implementation should actually copy over the
I’ll need to do some debugging to figure out what’s going on. Will let you know what comes out of it!
I neither have a good answer nor a strong opinion. After all, what “is” the source of an image? If it’s a reference to the file/location where it was originally loaded from, then the source should be gone after a manipulation, I think. But that would be inconvenient during processing I guess.
Quick follow-up: The location I pointed out earlier is from the Transfer Image Metadata node, which actually copies the source. For the Image Normalizer node, we are using Ops to create an output
Img of the form/dimensionality of the input and create a new
ImgPlus that contains the output
Img. The constructor of
ImgPlus does very explicitly call
setSource("") in this case because the
Img doesn’t have this kind of information.
Having said that, I could argue for both alternatives: Removing the source for each newly computed image (Image Normalizer) or keeping it (Gaussian Convolution), because it is a derivative of the source image. What do others think about that, @imagejan, @christian.dietz, @Manuel?
In any case, mixing both is confusing!
I agree the behavior should be consistent across all image processing nodes.
I think it doesn’t hurt if we lose the source information for newly computed/allocated images, as you can always join it in later from the original image metadata.
Of course it can be convenient to have it with the processed image as well in some cases. The question is then: are there any cases where you can have conflicting or confusing information due to having carried the source along while processing…
The only scenario that I could quickly come up with are nodes with multiple input images. In this case, it is quite obvious that you have to loose the source information.
Out of curiosity: Which information do you most often use for joining in that case?