Neural-Systems-at-UIO / QuickNII

https://quicknii.readthedocs.io
MIT License
7 stars 3 forks source link

Script or tool for separating series in a merged xml file #14

Closed ingrre closed 4 years ago

ingrre commented 4 years ago

We have registered a merged series (several N3-blocks in one anchoring) to atlas with QuickNII and would like to split this anchoring (one xml-file) into its respective blocks.

Use case: N3-project: NormaltRatBrain_TimmThionin, Animal: H200_Horizontal sections_rat. Anchoring found at Y:\hbp-02421\QuickNII_merged\new_H200_QuickNII_merged (thumbnails of block H200a and H200b has been merged to create one xml-file).

Tevemadar commented 4 years ago

NB! This is just the description of the problem, see next message for a solution which does not need editing/renaming things.

The merger (http://www.nesys.uio.no/QuickNII/Merge.html) can do the job out of the box. But: names have to match. In N3, the "a" series contains data like:

<metadata>
  <representation id="83569" name="841_3904_5946_H200a_Thionin_horizontal_s079"/>
  <representation id="83548" name="841_3904_5946_H200a_Thionin_horizontal_s151"/>

While the QuickNII XML looks like this:

<?xml version='1.0' encoding='UTF-8'?>
<series name='H200_TimmThionin_horizontal' first='0' last='0'>
    <slice filename='H200_TimmThionin_horizontal_s001.png' nr='1' width='960' height='1096' anchoring='ox=482.0004405026952&amp;oy=716.3409512701464&amp;oz=421.32679490431985&amp;ux=26.032862308979247&amp;uy=-345.92770886811314&amp;uz=-42.50094501820685&amp;vx=-535.3598069740497&amp;vy=-39.68950655246044&amp;vz=-4.876265446088723'/>
    <slice filename='H200_TimmThionin_horizontal_s002.png' nr='2' width='1048' height='1103' anchoring='ox=518.6782305446329&amp;oy=721.6405221045089&amp;oz=420.1828663779478&amp;ux=28.8764036138989&amp;uy=-384.26840837228656&amp;uz=-47.20693020149889&amp;vx=-601.6617530562744&amp;vy=-44.540539374055015&amp;vz=-5.47174140513755'/>

So the files have been renamed by someone and by Navigator too:

(the difference of .png is normal, QuickNII uses actual filenames, N3 does not) (In case of the "b" series, Navigator names contain a b, and ThimmThionin became Timm_dark)

If someone makes a copy of the QuickNII XML and carefully edts the filenames in it (for example adds the numbers, the a and removes Timm), the result merges correctly.

Tevemadar commented 4 years ago

For convenience an alternative version of Merge.html is provided now, Merge_s.html (http://www.nesys.uio.no/QuickNII/Merge_s.html). This version looks at the _s123 part of names only, so it can do the merging without fully matching names. The downside is the same: this utility does not recognize if XML-s come from different datasets by mistake, as long as there are matching sequence numbers, it will merge the data.

Majpuc commented 4 years ago

Could you try it out Ingrid?

Majpuc commented 4 years ago

First test was positive: http://cmbn-navigator.uio.no/navigator/filmstripzoom/filmstripzoom.html?atlas=200000&series=4906&preview=WHSRatv2Preview.png