forked from openslide/openslide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'openslide:main' into main
- Loading branch information
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma description Hamamatsu VMS .opt files | ||
|
||
#include <std/core.pat> | ||
#include <std/io.pat> | ||
#include <std/mem.pat> | ||
|
||
#pragma endian little | ||
|
||
struct Optimisation { | ||
u32 offset; | ||
padding[36]; | ||
} [[format_read("read_optimisation")]]; | ||
|
||
fn read_optimisation(Optimisation v) { | ||
return std::format("{} (0x{:08X})", v.offset, v.offset); | ||
}; | ||
|
||
Optimisation optimisations[while(!std::mem::eof())] @ 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#pragma description MIRAX Index.dat | ||
|
||
#include <std/io.pat> | ||
#include <std/mem.pat> | ||
|
||
#pragma endian little | ||
#pragma eval_depth 1024 | ||
|
||
// configured by the user in the Settings tab. | ||
// only the Slidedat knows how many records we have. | ||
u32 hier_record_count in; | ||
u32 nonhier_record_count in; | ||
|
||
struct HierEntry { | ||
u32 image; | ||
u32 offset; | ||
u32 length; | ||
u32 file; | ||
} [[format_read("format_hier_entry"), static]]; | ||
|
||
fn format_hier_entry(HierEntry e) { | ||
return std::format("[{}. {}, {}, {}]", e.image, e.offset, e.length, e.file); | ||
}; | ||
|
||
struct NonHierEntry { | ||
u32 padding1; | ||
u32 padding2; | ||
u32 offset; | ||
u32 length; | ||
u32 file; | ||
} [[format_read("format_nonhier_entry"), static]]; | ||
|
||
fn format_nonhier_entry(NonHierEntry e) { | ||
return std::format("[{}, {}, {}]", e.offset, e.length, e.file); | ||
}; | ||
|
||
u32 cur_page = 0; | ||
struct Page<Entry> { | ||
u32 page_num = cur_page; | ||
u32 count; | ||
u32 next; | ||
Entry entries[count]; | ||
} [[format_read("format_page"), name(std::format("[{}]", page_num))]]; | ||
|
||
fn format_page(auto p) { | ||
return std::format("[{} entries]", p.count); | ||
}; | ||
|
||
struct Pages<Entry> { | ||
Page<Entry> page; | ||
if (page.next != 0) { | ||
cur_page = cur_page + 1; | ||
Pages<Entry> next_page @ page.next [[inline]]; | ||
} | ||
} [[inline]]; | ||
|
||
struct Record<Entry> { | ||
if (std::mem::read_unsigned($, 4) != 0) { | ||
cur_page = 0; | ||
Pages<Entry> *pages : u32; | ||
} else { | ||
padding[4]; | ||
} | ||
}; | ||
|
||
struct File { | ||
char version[5]; | ||
char slide_id[32]; | ||
Record<HierEntry> *hier_records[hier_record_count] : u32; | ||
Record<NonHierEntry> *nonhier_records[nonhier_record_count] : u32; | ||
} [[inline]]; | ||
|
||
File file @ 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma description MIRAX VIMSLIDE_POSITION_BUFFER non-hierarchical section | ||
|
||
// TODO: support StitchingIntensityLevel, automatically inflating with | ||
// https://github.com/Jusb3/ImHex-Zlib-Plugin | ||
|
||
#include <std/io.pat> | ||
#include <std/mem.pat> | ||
|
||
#pragma endian little | ||
|
||
struct Position { | ||
u8 flags; | ||
s32 x; | ||
s32 y; | ||
} [[format_read("format_position"), static]]; | ||
|
||
fn format_position(Position p) { | ||
if (p.x == 0 && p.y == 0 && p.flags == 0) { | ||
return "-0-"; | ||
} | ||
return std::format("({}, {}) [{:x}]", p.x, p.y, p.flags); | ||
}; | ||
|
||
struct File { | ||
char version[5]; | ||
char slide_id[32]; | ||
char file[3]; | ||
padding[256]; | ||
Position positions[while(!std::mem::eof())]; | ||
} [[inline]]; | ||
|
||
File file @ 0; |