fixed errors that occured when building imageInputTests

This commit is contained in:
Jonas Hofmann 2025-11-17 21:57:25 +01:00
parent 07012e5c35
commit a2c2aae0fb

View File

@ -10,8 +10,8 @@
// übersichtlich aufgeteilt werden! // übersichtlich aufgeteilt werden!
// TODO Implementieren Sie geeignete Hilfsfunktionen für das Lesen der Bildserie aus einer Datei // TODO Implementieren Sie geeignete Hilfsfunktionen für das Lesen der Bildserie aus einer Datei
int readStatusInfo(FILE **source, char *const headerString, unsigned int *const imageCount, int *const imageWidth, int *const imageHeight, int const amountToRead); int readStatusInfo(FILE **source, char *const headerString, unsigned int *const imageCount, unsigned int *const imageWidth, unsigned int *const imageHeight, int const amountToRead);
void readImagedata(FILE **source, char *const imageBuffer, char *const labelBuffer,int const imageCount ,int const amountToRead); void readImagedata(FILE **source, unsigned char *const imageBuffer, unsigned char *const labelBuffer,int const imageCount ,int const amountToRead);
// TODO Vervollständigen Sie die Funktion readImages unter Benutzung Ihrer Hilfsfunktionen // TODO Vervollständigen Sie die Funktion readImages unter Benutzung Ihrer Hilfsfunktionen
@ -21,7 +21,6 @@ GrayScaleImageSeries *readImages(const char *path)
// selbst geschriebene Variablen // selbst geschriebene Variablen
FILE *readSource; FILE *readSource;
int i = 0;
unsigned int numberOfBytesToRead = 0; unsigned int numberOfBytesToRead = 0;
const unsigned int amountOfStatusInfoToRead = 1; const unsigned int amountOfStatusInfoToRead = 1;
char headerString[sizeof("__info2_image_file_format__")]; char headerString[sizeof("__info2_image_file_format__")];
@ -31,7 +30,7 @@ GrayScaleImageSeries *readImages(const char *path)
if (readSource != NULL) if (readSource != NULL)
{ {
printf("hier\n");
numberOfBytesToRead = readStatusInfo(&readSource, headerString, &series->count, &series->images->width, &series->images->height, amountOfStatusInfoToRead); numberOfBytesToRead = readStatusInfo(&readSource, headerString, &series->count, &series->images->width, &series->images->height, amountOfStatusInfoToRead);
series->images->buffer = calloc((series->count) * numberOfBytesToRead, sizeof(GrayScalePixelType)); series->images->buffer = calloc((series->count) * numberOfBytesToRead, sizeof(GrayScalePixelType));
@ -80,7 +79,7 @@ void clearSeries(GrayScaleImageSeries *series)
// reads string, pictureCount, pictureWidth, pictureHight // reads string, pictureCount, pictureWidth, pictureHight
int readStatusInfo(FILE **source, char *const headerString, unsigned int *const imageCount, int *const imageWidth, int *const imageHeight, int const amountToRead) int readStatusInfo(FILE **source, char *const headerString, unsigned int *const imageCount, unsigned int *const imageWidth, unsigned int *const imageHeight, int const amountToRead)
{ {
int bytesToRead = 0; int bytesToRead = 0;
@ -95,7 +94,7 @@ int readStatusInfo(FILE **source, char *const headerString, unsigned int *const
} }
// reads the imagebytes and the label of all images // reads the imagebytes and the label of all images
void readImagedata(FILE **source, char *const imageBuffer, char *const labelBuffer,int const imageCount , int const amountOfBytes) void readImagedata(FILE **source, unsigned char *const imageBuffer, unsigned char *const labelBuffer,int const imageCount , int const amountOfBytes)
{ {
int i = 0; int i = 0;