diff --git a/imageInput.c b/imageInput.c index a1b643a..ab24492 100644 --- a/imageInput.c +++ b/imageInput.c @@ -32,6 +32,31 @@ static FILE* openFileCheckHeader(const char *path) ///dass nun der header Teil gelesen wurde und somit die nächste Funktion ab dieser Stelle weiter liest. ///NULL, wenn falscher header. // TODO Vervollständigen Sie die Funktion readImages unter Benutzung Ihrer Hilfsfunktionen +static int readWidthHeightCount(FILE *fp, unsigned int *count, unsigned int *width, unsigned int *height) +{ + unsigned short count_s; + unsigned short width_s; + unsigned short height_s; + if(fread(&count_s, sizeof(unsigned short), 1, fp) != 1) + { + return -1; + } + if(fread(&width_s, sizeof(unsigned short), 1, fp) != 1) + { + return -1; + } + if(fread(&height_s, sizeof(unsigned short), 1, fp) != 1) + { + return -1; + } + *count = (unsigned int)count_s; + *width = (unsigned int)width_s; + *height = (unsigned int)height_s; + return 0; +} +/* +readWidthHeightCount: liest die drei shorts ein, welche Hoehe, Breite und Anzahl sind. (SHORT!!) +*/ GrayScaleImageSeries *readImages(const char *path) { GrayScaleImageSeries *series = NULL;