-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from magnostherobot/sysvinit/czinspect
czinspect: implement subsampling ratio scanning and filtering
- Loading branch information
Showing
12 changed files
with
279 additions
and
17 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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Usage: czinspect -S [options] <file> | ||
|
||
This operation does not have any options, and is currently unimplemented. | ||
This operation does not have any options. |
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
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
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
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
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
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,65 @@ | ||
|
||
#include "config.h" | ||
|
||
#include <err.h> | ||
#include <inttypes.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
#include "types.h" | ||
#include "alloc.h" | ||
#include "macros.h" | ||
#include "mapfile.h" | ||
#include "util.h" | ||
#include "zeiss.h" | ||
#include "zeissio.h" | ||
|
||
static void parse_opts(struct config *cfg) { | ||
/* currently a nop */ | ||
(void)cfg; | ||
return; | ||
} | ||
|
||
void do_scan(struct config *cfg) { | ||
struct czi_seg_header head; | ||
struct czi_zrf zisrf; | ||
struct map_ctx *c; | ||
lzbuf reslist; | ||
uint32_t rnum = 0; | ||
|
||
parse_opts(cfg); | ||
|
||
c = cfg->inctx; | ||
|
||
/* read initial segment */ | ||
if (czi_read_sh(c, &head) == -1) | ||
ferrx1("could not read initial segment header from input file"); | ||
|
||
if (czi_getsegid(&head) != ZISRAWFILE) | ||
ferrx1("input file does not start with a ZISRAWFILE segment"); | ||
|
||
if (czi_read_zrf(c, &zisrf) == -1) | ||
ferrx1("could not read ZISRAWFILE segment"); | ||
|
||
/* XXX this should be changed when segment-local scanning is implemented */ | ||
if (zisrf.directory_position == 0) | ||
ferrx1("file contains no subblock directory, cannot scan for subsampling levels"); | ||
|
||
if (map_seek(c, zisrf.directory_position, MAP_SET) == -1) | ||
ferrx("could not seek to offset %" PRIu64 " to read subblock directory", zisrf.directory_position); | ||
|
||
reslist = lzbuf_new(uint32_t); | ||
|
||
if (make_reslist(c, reslist, &rnum) == -1) | ||
ferrx1("could not scan for subsampling levels in input file"); | ||
|
||
printf("Available subsampling levels (smaller number indicates higher resolution):\n\n"); | ||
|
||
for (uint32_t i = 0; i < rnum; i++) | ||
printf("\t%" PRIu32 "\n", lzbuf_get(uint32_t, reslist, i)); | ||
|
||
printf("\n"); | ||
lzbuf_free(reslist); | ||
|
||
return; | ||
} |
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
Oops, something went wrong.