[vtkusers] staking a seires of bmp files

Veerapuram Varadhan v.varadhan at californiadigital.com
Tue Apr 6 08:39:34 EDT 2004


Hi Mathieu,

According to the piece of code in vtkImageReader2.cxx function
ComputeInternalFileName(int slice)...

  // make sure we figure out a filename to open
  if (this->FileName)
    {
    this->InternalFileName = new char [strlen(this->FileName) + 10];
    sprintf(this->InternalFileName,"%s",this->FileName);
    }
  else
    {
    int slicenum =
      slice * this->FileNameSliceSpacing
      + this->FileNameSliceOffset;
    if (this->FilePrefix && this->FilePattern)
      {
      this->InternalFileName = new char [strlen(this->FilePrefix) +
                                        strlen(this->FilePattern) + 10];
>>>>>      sprintf (this->InternalFileName, this->FilePattern,
>>>>>               this->FilePrefix, slicenum);
      }
    else if (this->FilePattern)
      {
       .........
       ..........
      }

In the current scenario, both this->FilePrefix,this->FilePattern are not
NULL. So, this->InternalFileName will be...

sprintf (this->InternalFileName, "%s%d.bmp", this->FilePrefix, slicenum);

on expanding this->FilePrefix and slicenum = 1...

sprintf (this->InternalFileName, "%s%d.bmp", "C:/foo", 1);

so, the final value in
this->InternalFileName = "C:/foo1.bmp"

I don't think that would be a problem (according to the above theory).

Megha, can you put a breakpoint in the above function to see whether the
filenames that are being formed are correct or not.  Also, do you have the
files in a subdirectory or "C:/foo1.bmp" is the correct path.

Also, try not to use vtkPolyDataMapper.

Mathieu.. kindly correct me if I am wrong.

HTH..

V. Varadhan.
> megha agarwal wrote:
>> dear frens
>>  > as directed by you, i have tried reading a series of bmp files, but i
>> am
>>  > unable to do so.
>>  > here is the code that i have used
>>  >
>>  > # For 512 x 512 images foo1 to foo100
>>  >
>>  > vtkBMPReader* bmp_d = vtkBMPReader::New();
>>  > bmp_d->SetFilePrefix ("c:/foo"); // base file prefix for a series
>>  > bmp_d->SetFilePattern ("%s%d.bmp");
>
> Do you run your example in console mode ? The reader should complain and
> give a reason why. I suspect because you did not specify the directory
> separation:
>
>
> bmp_d->SetFilePrefix ("c:/foo/");
>                               ^
>
> HTH
> Mathieu
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list