tested programm
This commit is contained in:
parent
ae541fec66
commit
84139cae5f
35
imageInput.c
35
imageInput.c
@ -26,21 +26,15 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
const unsigned int amountOfStatusInfoToRead = 1;
|
const unsigned int amountOfStatusInfoToRead = 1;
|
||||||
char headerString[sizeof("__info2_image_file_format__\0")] = "";
|
char headerString[sizeof("__info2_image_file_format__\0")] = "";
|
||||||
|
|
||||||
/*
|
|
||||||
char curChar = 0;
|
char curChar = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
|
||||||
// dieses print(hier) wird nur einmal aufgerufen,
|
|
||||||
// der zweite test schafft es also nicht readImages
|
|
||||||
// korrekt aufzurufen!!!!!
|
|
||||||
printf("hier\n");
|
|
||||||
*/
|
|
||||||
readSource = fopen(path, "rb");
|
readSource = fopen(path, "rb");
|
||||||
|
|
||||||
if (readSource != NULL)
|
if (readSource != NULL)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
// print entire source char by char
|
// print entire source char by char
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -54,7 +48,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
i++;
|
i++;
|
||||||
} while (curChar != EOF);
|
} while (curChar != EOF);
|
||||||
// print entire source char by char
|
// print entire source char by char
|
||||||
*/
|
|
||||||
series = calloc(sizeof(unsigned int) + 3* sizeof(headerString), amountOfStatusInfoToRead);
|
series = calloc(sizeof(unsigned int) + 3* sizeof(headerString), amountOfStatusInfoToRead);
|
||||||
series->images = calloc(2*sizeof(unsigned int) + sizeof(headerString), amountOfStatusInfoToRead);
|
series->images = calloc(2*sizeof(unsigned int) + sizeof(headerString), amountOfStatusInfoToRead);
|
||||||
|
|
||||||
@ -62,7 +56,13 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
|
|
||||||
series->images->buffer = calloc((series->count) * numberOfBytesToRead, sizeof(GrayScalePixelType));
|
series->images->buffer = calloc((series->count) * numberOfBytesToRead, sizeof(GrayScalePixelType));
|
||||||
series->labels = calloc((series->count), sizeof(&(series->labels)));
|
series->labels = calloc((series->count), sizeof(&(series->labels)));
|
||||||
|
printf("%d\n", series->images[0].width);
|
||||||
|
// series->images[1].width is not being set
|
||||||
|
// implement setting several amoundt of status info
|
||||||
|
// for when several images are bing read
|
||||||
|
// also adjust amoung of memory allocated for
|
||||||
|
// staus info based on the number of images to be read
|
||||||
|
printf("%d\n", series->images[1].width);
|
||||||
readImagedata(readSource, series->images->buffer, series->labels, series->count, numberOfBytesToRead);
|
readImagedata(readSource, series->images->buffer, series->labels, series->count, numberOfBytesToRead);
|
||||||
|
|
||||||
fclose(readSource);
|
fclose(readSource);
|
||||||
@ -109,24 +109,21 @@ void clearSeries(GrayScaleImageSeries *series)
|
|||||||
unsigned int readStatusInfo(FILE *source, char *const headerString, unsigned int *const imageCount, unsigned int *const imageWidth, unsigned int *const imageHeight, int const amountToRead)
|
unsigned int readStatusInfo(FILE *source, char *const headerString, unsigned int *const imageCount, unsigned int *const imageWidth, unsigned int *const imageHeight, int const amountToRead)
|
||||||
{
|
{
|
||||||
unsigned int bytesToRead = 0;
|
unsigned int bytesToRead = 0;
|
||||||
/*
|
|
||||||
int numred = 0;
|
int numred = 0;
|
||||||
int numred2 = 0;
|
int numred2 = 0;
|
||||||
int numred3 = 0;
|
int numred3 = 0;
|
||||||
int numred4 = 0;
|
int numred4 = 0;
|
||||||
*/
|
|
||||||
|
|
||||||
//unsigned int imageCountBuffer = 0;
|
//unsigned int imageCountBuffer = 0;
|
||||||
fread(headerString, 27, 1, source);
|
numred = fread(headerString, 27, 1, source);
|
||||||
fread(imageCount, 2, 1, source);
|
numred2 = fread(imageCount, 2, 1, source);
|
||||||
fread(imageWidth, 2, 1, source);
|
numred3 = fread(imageWidth, 2, 1, source);
|
||||||
fread(imageHeight, 2, 1, source);
|
numred4 = fread(imageHeight, 2, 1, source);
|
||||||
|
|
||||||
bytesToRead = (*imageWidth) * (*imageHeight);
|
bytesToRead = (*imageWidth) * (*imageHeight);
|
||||||
/*
|
/*
|
||||||
printf("imgCntBuffer: %u\n", imageCountBuffer);
|
|
||||||
*imageCount = imageCountBuffer;
|
|
||||||
|
|
||||||
printf("numred: %d\n", numred);
|
printf("numred: %d\n", numred);
|
||||||
printf("stringsize: %lld\n", sizeof("__info2_image_file_format__"));
|
printf("stringsize: %lld\n", sizeof("__info2_image_file_format__"));
|
||||||
printf("string: %send\n", headerString);
|
printf("string: %send\n", headerString);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user