Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aperio ImageScope xml problem #94

Closed
kirmedvedev opened this issue Dec 9, 2021 · 14 comments
Closed

Aperio ImageScope xml problem #94

kirmedvedev opened this issue Dec 9, 2021 · 14 comments

Comments

@kirmedvedev
Copy link

Dear Nicolas,

I am trying to use ImageScope ROIs saved as xml format to tile svs image and got error from the line 952.
Here is my command:
../DeepPATH_code/00_preprocessing/0b_tileLoop_deepzoom5.py -s 299 -e 0 -j 32 -B 25 -o ../imagescope_test/out "../seminoma/TCGA-XE-AAO4_svs/*.svs" -x ../imagescope_test/xml_seminoma/

Error:
Traceback (most recent call last): File "../DeepPATH_code/00_preprocessing/0b_tileLoop_deepzoom5.py", line 952, in <module> if (opts.oLabelref in oLabel) or (opts.oLabelref==''): TypeError: 'in <string>' requires string as left operand, not NoneType

My xml file (uploaded as txt):
TCGA-XE-AAO4-01Z-00-DX1.xml.txt

Is something wrong with xml file?
I tried to use -F option to change the label field but still got the same error.

Thank you in advance!

@ncoudray
Copy link
Owner

ncoudray commented Dec 9, 2021

Hi -
The xml file should end with .xml, not txt
If it still fails, I would advise to try 0b_tileLoop_deepzoom6 instead of 0b_tileLoop_deepzoom5, which is the latest version
Also, check the labels exist or are in the proper field (to be set with the -F option)
HTH,
Best,
Nicolas

@kirmedvedev
Copy link
Author

kirmedvedev commented Dec 9, 2021

Thanks for your prompt reply!
Yes, my xml file ends with .xml (github does not allow to upload xml files, so I added txt to upload it).
Using 0b_tileLoop_deepzoom6:
../DeepPATH_code/00_preprocessing/0b_tileLoop_deepzoom6.py -s 299 -e 0 -j 32 -B 25 -o ../imagescope_test/out "../seminoma/TCGA-XE-AAO4_svs/*.svs" -x ../imagescope_test/xml_seminoma/ -F Name
I got new error:
Traceback (most recent call last): File "../DeepPATH_code/00_preprocessing/0b_tileLoop_deepzoom6.py", line 1233, in <module> Adj_WindowSize = self._tile_size NameError: name 'self' is not defined

I am not familiar how Aperio xmls should looks like, may be something is wrong with mine...
At least field Name defines the label:
<Annotations MicronsPerPixel="0.252700"> <Annotation Id="1" Name="seminoma" ReadOnly="0" NameReadOnly="0" LineColorReadOnly="0"...

Thanks!

@ncoudray
Copy link
Owner

ncoudray commented Dec 9, 2021

This is an example of the first few lines of one of my xml files:

<Annotations MicronsPerPixel="0.503100">
	<Annotation Id="1" Name="" ReadOnly="0" NameReadOnly="0" LineColorReadOnly="0" Incremental="0" Type="4" LineColor="0" Visible="1" Selected="0" MarkupImagePath="" MacroName=""><Attributes><Attribute Name="Tumor" Id="0" Value=""/>
		</Attributes><Regions><RegionAttributeHeaders><AttributeHeader Id="9999" Name="Region" ColumnWidth="-1"/><AttributeHeader Id="9997" Name="Length" ColumnWidth="-1"/><AttributeHeader Id="9996" Name="Area" ColumnWidth="-1"/><AttributeHeader Id="9998" Name="Text" ColumnWidth="-1"/><AttributeHeader Id="1
" Name="Description" ColumnWidth="-1"/></RegionAttributeHeaders><Region Id="1" Type="0" Zoom="0.152475" Selected="0" ImageLocation="" ImageFocus="-1" Length="3896.4" Area="1042489.5" LengthMicrons="1960.3" AreaMicrons="263864.1" Text="" NegativeROA="0" InputRegionId="0" Analyze="1" DisplayId="1"><Attributes></Attri
butes><Vertices><Vertex X="32648" Y="14304" Z="0"/><Vertex X="32622" Y="14304" Z="0"/><Vertex X="32609" Y="14311" Z="0"/><Vertex X="32583" Y="14311" Z="0"/><Vertex X="32563" Y="14324" Z="0"/><Vertex X="32537" Y="14344" Z="0"/><Vertex X="32504" Y="14370" Z="0"/><Vertex X="32478" Y="14396" Z="0"/><Vertex X="32451" Y=
"14416" Z="0"/><Vertex X="32438" Y="14442" Z="0"/>

@ncoudray
Copy link
Owner

ncoudray commented Dec 9, 2021

so you should have vertices with the coordinates of the contours of the region selected

@ncoudray
Copy link
Owner

ncoudray commented Dec 9, 2021

Also, I think I may have introduced a bug in the v6 last time I changed it. Please try to replace line 1233 with
Adj_WindowSize = opts.tile_size

@kirmedvedev
Copy link
Author

Also, I think I may have introduced a bug in the v6 last time I changed it. Please try to replace line 1233 with Adj_WindowSize = opts.tile_size

It definitely helped, thank you! Script at least start running.
However it generates empty folders with no tiles.

My xml does contain coordinates. The whole xml looks like this:

<Annotations MicronsPerPixel="0.252700">
	<Annotation Id="1" Name="seminoma" ReadOnly="0" NameReadOnly="0" LineColorReadOnly="0" Incremental="0" Type="4" LineColor="16776960" Visible="1" Selected="1" MarkupImagePath="" MacroName=""><Attributes><Attribute Name="Description" Id="0" Value=""/>
		</Attributes><Regions><RegionAttributeHeaders><AttributeHeader Id="9999" Name="Region" ColumnWidth="-1"/><AttributeHeader Id="9997" Name="Length" ColumnWidth="-1"/>
<AttributeHeader Id="9996" Name="Area" ColumnWidth="-1"/><AttributeHeader Id="9998" Name="Text" ColumnWidth="-1"/><AttributeHeader Id="1" Name="Description" ColumnWidth="-1"/></RegionAttributeHeaders>
<Region Id="1" Type="2" Zoom="0.031443" Selected="1" ImageLocation="" ImageFocus="-1" Length="10341.9" Area="8496720.1" LengthMicrons="2613.4" AreaMicrons="542577.5" Text="" NegativeROA="0" InputRegionId="0" Analyze="0" DisplayId="1"><Attributes></Attributes><Vertices><Vertex X="57596.737722" Y="19750.224743" Z="0"/><Vertex X="60999.729786" Y="22930.591157" Z="0"/></Vertices></Region></Regions><Plots></Plots></Annotation></Annotations>

My ROI is very small, I just want to test how script is working:
Picture1

What can be the reason for empty tile folders?
Thank you!

@ncoudray
Copy link
Owner

ncoudray commented Dec 9, 2021

Is it your whole xml? Looks like it has only 1 coordinate. Also, I never tested it with "circles" and "square" tools. It is meant for the selections made with the "free hand" tools

@kirmedvedev
Copy link
Author

Is it your whole xml? Looks like it has only 1 coordinate. Also, I never tested it with "circles" and "square" tools. It is meant for the selections made with the "free hand" tools

Yes it is my whole xml. Hmm, really looks like it has coordinates for only two dots...
Will try "free hand" tools to define ROI.
Thanks for your help!

@kirmedvedev
Copy link
Author

I have one more kind of related question.
README mentioned if the classes come from the TCGA's metadata file...
Could you please share what kind of classes can be retrieved from TCGA's metadata files?

If we take for example the one you shared some time ago: #14 (comment)
I don't see any kind of classes there.
The same for slides I am looking at.
Is it available not for all cancer types?

Thank you in advance!

@ncoudray
Copy link
Owner

When you get into the repository to download svs images, you can also download associated biospecimen and clinical files with different types of information (it can be if the tissue contains tumor or just normal tissue, whether to the tumor is LUSC, LUAD or MESO for example for Lung, the stage, etc...).
Have a look at the GDC TCGA website and you will see all types of data that can be retrieved.

The json file in our original paper was retrieved from the "legacy" website. The format seems to have changed in the new one.

@kirmedvedev
Copy link
Author

Is it your whole xml? Looks like it has only 1 coordinate. Also, I never tested it with "circles" and "square" tools. It is meant for the selections made with the "free hand" tools

Ok, so "free hand" tools works much better, I have much bigger xml with many coordinates.
However again all folders where tiles suppose to be are still empty.

Mask file at least recognizes my ROI. Is it suppose to look like this - everything black with ROI contour?
mask_TCGA-XE-AAO4-01Z-00-DX1_seminoma

Any other possible reasons for empty output?
Thank you!

@ncoudray
Copy link
Owner

After being run on deepzoom, the ROI is supposed to be filled with white. There may be still something weird with your xml file.

@ncoudray
Copy link
Owner

1 - you need to select the annotation tool:
image

2- then use this window to add potential labels / regions
image

3- then draw with the positive selection free hand tool
image

@kirmedvedev
Copy link
Author

It is working! Thank you so much!

It is turned out that xml does not work when I used "Export Annotations to File".
But when I use xml file from "Save Annotation" button, everything works perfectly.
There seems to be some difference between these actions.

Really appreciate your help and time.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants