changed for loop in line 47 of readImages()
This commit is contained in:
parent
51d02f32c2
commit
4999631b9e
17
imageInput.c
17
imageInput.c
@ -18,7 +18,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
{
|
{
|
||||||
GrayScaleImageSeries *series = NULL;
|
GrayScaleImageSeries *series = NULL;
|
||||||
FILE *readSource = 0;
|
FILE *readSource = 0;
|
||||||
const unsigned int sizeOfStausInfoElementsInBytes = 2;
|
const unsigned int sizeOfStausInfoElementsInBytes = sizeof(unsigned short);
|
||||||
const unsigned int amountOfStatusInfoToRead = 1;
|
const unsigned int amountOfStatusInfoToRead = 1;
|
||||||
unsigned int numberOfBytesToRead = 0;
|
unsigned int numberOfBytesToRead = 0;
|
||||||
unsigned int expectedHeader = 0;
|
unsigned int expectedHeader = 0;
|
||||||
@ -41,31 +41,26 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
|
|
||||||
if (expectedHeader)
|
if (expectedHeader)
|
||||||
{
|
{
|
||||||
printf("expected Header!\n");
|
|
||||||
// reallocate memory so that each image width can be saved seperately
|
// reallocate memory so that each image width can be saved seperately
|
||||||
series->images = realloc(series->images, series->count * 2 * sizeof(unsigned int) + sizeof(headerString));
|
series->images = realloc(series->images, series->count * 2 * sizeof(unsigned int) + sizeof(headerString));
|
||||||
|
|
||||||
printf("count: %d", series->count);
|
// for loop was previously running with i < series->count, wich caused programm to crash.
|
||||||
series->images[2].width = series->images->width;
|
for (int i = 0; i < 2; i++)
|
||||||
series->images[2].height = series->images->height;
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < series->count; i++)
|
|
||||||
{
|
{
|
||||||
series->images[i].width = series->images->width;
|
series->images[i].width = series->images->width;
|
||||||
series->images[i].height = series->images->height;
|
series->images[i].height = series->images->height;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
printf("afer for Loop! \n");
|
|
||||||
readImagedata(readSource, series, numberOfBytesToRead);
|
readImagedata(readSource, series, numberOfBytesToRead);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
series = NULL;
|
series = NULL;
|
||||||
}
|
}
|
||||||
printf("before read Source\n");
|
|
||||||
fclose(readSource);
|
fclose(readSource);
|
||||||
}
|
}
|
||||||
printf("finished reading!\n");
|
|
||||||
|
|
||||||
return series;
|
return series;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user