Losing Metadata/Headers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Losing Metadata/Headers

J. Daniel Fenn
When I manipulate an image I appear to be losing some of the
metadata/header information that you get access to through the
Image->"Show Info" dialogue.  How can I keep this data across images?

For example.  I have a tiff stack of 30+ images.  If I make a Z maximum
projection of that stack, the resultant single image is missing nearly
all of the unique metadata that was found in the original stack.

I also tried combining two tiff stacks of 30 images.  The resultant 60
image stack did not include the metadata from the original stack.

How do I pass this metadata/header information from image to image?

The images are initially created in Metamorph and I need to keep that
file info in the images.  Can anyone help/guide me?  Thanks

-Dan

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Losing Metadata/Headers

fabrice senger-2
Hi,

the header structure is not the same in Metamorph and in imageJ, i.e., you
will not get the same amount of information.
What I do to keep basic information is to use Get and Set metadata in a
short macro so I can retrieve the info from the original images to the
processed ones.
Of course you should always keep the original data.

Cheers ,

Fabrice.


2014-03-18 1:52 GMT+01:00 J. Daniel Fenn <[hidden email]>:

> When I manipulate an image I appear to be losing some of the
> metadata/header information that you get access to through the
> Image->"Show Info" dialogue.  How can I keep this data across images?
>
> For example.  I have a tiff stack of 30+ images.  If I make a Z maximum
> projection of that stack, the resultant single image is missing nearly
> all of the unique metadata that was found in the original stack.
>
> I also tried combining two tiff stacks of 30 images.  The resultant 60
> image stack did not include the metadata from the original stack.
>
> How do I pass this metadata/header information from image to image?
>
> The images are initially created in Metamorph and I need to keep that
> file info in the images.  Can anyone help/guide me?  Thanks
>
> -Dan
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Losing Metadata/Headers

J. Daniel Fenn
In reply to this post by J. Daniel Fenn
That's true that they are different.  But the metadata is still there.  When you open a tiff straight from metamorph in Fiji, you can see the XML data in the image info dialogue.  The MM data is passed in under the "Image Description" tag.

But when I manipulate the image, it doesn't pass any of that data from one image to the next.  I would think that it makes most sense to always copy the current header info and pass it to the subsequent images, regardless of the source of that info.

To test this, I manually added metadata to a blank image (taking Metamorph out of the picture).  Still the same result.  The manually added metadata still did not get passed to subsequent images.

This seems like a bug to me.  I can't envision a situation where passing the header information from image to image would not be beneficial.

I guess for now I can look into how to use a macro to pass the information.  I'm not exactly sure how to do that, so if someone could point me in the right direction that would be great.  If not I'll see what I can find and ask a new question as needed.

Thanks.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Losing Metadata/Headers

Michael Schmid
Hi Daniel,

if you manipulate an image, the metadata (extra items at the top of the image info) are kept as long as it remains the same image.

For operations with more than one image, e.g. Image Calculator, combining stacks, etc., I see no good way to solve your problem:  You may have the same or different metadata for the source images, and then it becomes a mess.

One could consider keeping the metadata for operations with only one input image, one by one:
- Duplicate - duplicates the metadata anyhow.
- FFT and Inverse FFT: keeping metadata could be possible, but it would be some effort because FFT adds metadata that have to be removed on Inverse FFT.
- Stack operations such as z project: there it could be added, but I am not sure that it would be good in any case.  E.g., a maximum projection is something very different from an original image, and seeing the metadata of image recording might be deceiving for users who might then think that this is essentially an original image.

A related topic that has been discussed on the mailing list previously:  Storing all the processing history of an image.  That would be a huge effort, considering that the history of all images that are used to create the final output has to be stored as well.  Just record a macro while you are duplicating an image, do some operations on it to create a background, and finally subtract the background from the original.  Even for simple sequences of operations, the macro code won't be very readable.
I don't think we will ever have this in ImageJ 1.x; I don't know whether it will be accomplished in ImageJ 2.

So far a few thoughts...

Michael
________________________________________________________________


On Mar 20, 2014, at 19:33, J. Daniel Fenn wrote:

> That's true that they are different.  But the metadata is still there.  When you open a tiff straight from metamorph in Fiji, you can see the XML data in the image info dialogue.  The MM data is passed in under the "Image Description" tag.
>
> But when I manipulate the image, it doesn't pass any of that data from one image to the next.  I would think that it makes most sense to always copy the current header info and pass it to the subsequent images, regardless of the source of that info.
>
> To test this, I manually added metadata to a blank image (taking Metamorph out of the picture).  Still the same result.  The manually added metadata still did not get passed to subsequent images.
>
> This seems like a bug to me.  I can't envision a situation where passing the header information from image to image would not be beneficial.
>
> I guess for now I can look into how to use a macro to pass the information.  I'm not exactly sure how to do that, so if someone could point me in the right direction that would be great.  If not I'll see what I can find and ask a new question as needed.
>
> Thanks.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Losing Metadata/Headers

rthomas986
In reply to this post by J. Daniel Fenn
What you can do it collect the information on the original image before you manipulate it. Then save each of your iterations/manipulations with an updated extension of the original file name.

For example:

ID= getImage();
dir=getDirectory(ID);
name=getTitle;

//now that you have your Metadata secured you can run your operation of interest. I will use duplicate as an example

run("Duplicate...");

index = lastIndexOf(name, ".");
if (index!=-1) name=substring(name,0,index);
name1=name+"_edited1";
saveAs("Tiff", dir+name1);


You can do this after each operation, changing the variable (name1, name2,etc) and the desired extension for the new file name. This way if your original image is "XXX.tiff" then the duplicate will be "XXX_edited1.tiff"

I hope this helps.

Richelle

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of J. Daniel Fenn
Sent: Thursday, March 20, 2014 2:34 PM
To: [hidden email]
Subject: Re: Losing Metadata/Headers

That's true that they are different.  But the metadata is still there.  When you open a tiff straight from metamorph in Fiji, you can see the XML data in the image info dialogue.  The MM data is passed in under the "Image Description" tag.

But when I manipulate the image, it doesn't pass any of that data from one image to the next.  I would think that it makes most sense to always copy the current header info and pass it to the subsequent images, regardless of the source of that info.

To test this, I manually added metadata to a blank image (taking Metamorph out of the picture).  Still the same result.  The manually added metadata still did not get passed to subsequent images.

This seems like a bug to me.  I can't envision a situation where passing the header information from image to image would not be beneficial.

I guess for now I can look into how to use a macro to pass the information.  I'm not exactly sure how to do that, so if someone could point me in the right direction that would be great.  If not I'll see what I can find and ask a new question as needed.

Thanks.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html


The information contained in this communication and its attachment(s) is intended only for the use of the individual to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [hidden email] and delete the communication without retaining any copies. Thank you.

Translations available: http://www.owenscorning.com/emailfooter.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Losing Metadata/Headers

Gabriel Landini
In reply to this post by J. Daniel Fenn
On Thursday 20 Mar 2014 14:33:38 you wrote:
> To test this, I manually added metadata to a blank image (taking Metamorph
> out of the picture).  Still the same result.  The manually added metadata
> still did not get passed to subsequent images.
>
> This seems like a bug to me.  I can't envision a situation where passing the
> header information from image to image would not be beneficial.

I can think of 3:
Confidential/patient data gets transmitted to other images without anybody
noticing it (like the infamous Word document "properties") and ends up
posted all over the net.

Metadata is inaccurate after processing the image (resolution, bit depth,
calibration, size). You send the image to somebody else and they make wrong
assumptions about the image.

Metadata could make images larger when it is not needed.

Despite that, I see the benefit to transfer metadata when you want it, and you
are sure it is accurate, so a better solution would be to have a command that
copies the metadata from one image into another.

There are already commands for this, not sure if they do what you want:
getMetadata("Info")
Returns the metadata (a string) from the "Info" property of the current image.
With DICOM images, this is the information (tags) in the DICOM header. See
also: setMetadata.

getMetadata("Label")
Returns the current slice label. The first line of the this label (up to 60
characters) is display as part of the image subtitle. With DICOM stacks,
returns the metadata from the DICOM header. See also: setMetadata.

setMetadata("Info", string)
Assigns the metadata in string to the "Info" image property of the current
image. This metadata is displayed by Image>Show Info and saved as part of the
TIFF header. See also: getMetadata.

setMetadata("Label", string)
Sets string as the label of the current image or stack slice. The first 60
characters, or up to the first newline, of the label are displayed as part of
the image subtitle. The labels are saved as part of the TIFF header. See also:
getMetadata.

Hope this helps.
Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html